idnits 2.17.00 (12 Aug 2021) /tmp/idnits1206/draft-ietf-emailcore-rfc5321bis-02.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 ([5321bis]), 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. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (February 21, 2021) is 453 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) -- Looks like a reference, but probably isn't: '5321bis' on line 4501 -- Looks like a reference, but probably isn't: 'RFC3463' on line 2316 -- Looks like a reference, but probably isn't: 'RFC5248' on line 2317 -- Possible downref: Non-RFC (?) normative reference: ref. '2' ** Obsolete normative reference: RFC 821 (ref. '3') (Obsoleted by RFC 2821) -- Obsolete informational reference (is this intentional?): RFC 822 (ref. '12') (Obsoleted by RFC 2822) -- Obsolete informational reference (is this intentional?): RFC 974 (ref. '15') (Obsoleted by RFC 2821) -- Obsolete informational reference (is this intentional?): RFC 1869 (ref. '21') (Obsoleted by RFC 2821) -- Obsolete informational reference (is this intentional?): RFC 2821 (ref. '29') (Obsoleted by RFC 5321) -- Obsolete informational reference (is this intentional?): RFC 3501 (ref. '36') (Obsoleted by RFC 9051) Summary: 2 errors (**), 0 flaws (~~), 2 warnings (==), 14 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 EMAILCORE J. Klensin 3 Internet-Draft February 21, 2021 4 Obsoletes: 5321, 1846, 7504 (if 5 approved) 6 Intended status: Standards Track 7 Expires: August 25, 2021 9 Simple Mail Transfer Protocol 10 draft-ietf-emailcore-rfc5321bis-02 12 Abstract 14 This document is a specification of the basic protocol for Internet 15 electronic mail transport. It consolidates, updates, and clarifies 16 several previous documents, making all or parts of most of them 17 obsolete. It covers the SMTP extension mechanisms and best practices 18 for the contemporary Internet, but does not provide details about 19 particular extensions. Although SMTP was designed as a mail 20 transport and delivery protocol, this specification also contains 21 information that is important to its use as a "mail submission" 22 protocol for "split-UA" (User Agent) mail reading systems and mobile 23 environments. This document replaces the earlier version with the 24 same title in RFC 5321. 25 [[CREF1: Note in Draft: Except for the last sentence, the above is 26 unchanged from 5321 and may need adjusting in the light of RFC 6409 27 (Message Submission) as an Internet Standard.]] 29 Note on Reading This Working Draft 31 This working draft is extensively annotated with information about 32 changes made over the decade since RFC 5321 appeared, especially when 33 those changes might be controversial or should get careful review. 34 Anything marked in CREF comments with "[5321bis]" is current. In 35 general, unless those are marked with "[[Note in Draft", in the 36 contents of an "Editor's note", or are in the "Errata Summary" 37 appendix (Appendix H.1, they are just notes on changes that have 38 already been made and where those 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 As people review or try to use this document, it may be worth paying 49 special attention to the historical discussion in Section 1.2. The 50 decision to merge documents rather than do a complete rewrite was 51 motivated by weighing the risks of inadvertently introducing changes 52 against greater readability and deciding to preserve close 53 approximations to original text and document structures in most 54 cases. One result is that information may not be be organized as the 55 reader might expect. An index is provided to assist in the quest for 56 information. 58 This evolving draft should be discussed on the emailcore@ietf.org 59 list. 61 Status of This Memo 63 This Internet-Draft is submitted in full conformance with the 64 provisions of BCP 78 and BCP 79. 66 Internet-Drafts are working documents of the Internet Engineering 67 Task Force (IETF). Note that other groups may also distribute 68 working documents as Internet-Drafts. The list of current Internet- 69 Drafts is at https://datatracker.ietf.org/drafts/current/. 71 Internet-Drafts are draft documents valid for a maximum of six months 72 and may be updated, replaced, or obsoleted by other documents at any 73 time. It is inappropriate to use Internet-Drafts as reference 74 material or to cite them other than as "work in progress." 76 This Internet-Draft will expire on August 25, 2021. 78 Copyright Notice 80 Copyright (c) 2021 IETF Trust and the persons identified as the 81 document authors. All rights reserved. 83 This document is subject to BCP 78 and the IETF Trust's Legal 84 Provisions Relating to IETF Documents 85 (https://trustee.ietf.org/license-info) in effect on the date of 86 publication of this document. Please review these documents 87 carefully, as they describe your rights and restrictions with respect 88 to this document. Code Components extracted from this document must 89 include Simplified BSD License text as described in Section 4.e of 90 the Trust Legal Provisions and are provided without warranty as 91 described in the Simplified BSD License. 93 Table of Contents 95 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 6 96 1.1. Transport of Electronic Mail . . . . . . . . . . . . . . 6 97 1.2. History and Context for This Document . . . . . . . . . . 7 98 1.3. Document Conventions . . . . . . . . . . . . . . . . . . 8 99 2. The SMTP Model . . . . . . . . . . . . . . . . . . . . . . . 8 100 2.1. Basic Structure . . . . . . . . . . . . . . . . . . . . . 8 101 2.2. The Extension Model . . . . . . . . . . . . . . . . . . . 11 102 2.2.1. Background . . . . . . . . . . . . . . . . . . . . . 11 103 2.2.2. Definition and Registration of Extensions . . . . . . 12 104 2.2.3. Special Issues with Extensions . . . . . . . . . . . 13 105 2.3. SMTP Terminology . . . . . . . . . . . . . . . . . . . . 13 106 2.3.1. Mail Objects . . . . . . . . . . . . . . . . . . . . 13 107 2.3.2. Senders and Receivers . . . . . . . . . . . . . . . . 14 108 2.3.3. Mail Agents and Message Stores . . . . . . . . . . . 14 109 2.3.4. Host . . . . . . . . . . . . . . . . . . . . . . . . 14 110 2.3.5. Domain Names . . . . . . . . . . . . . . . . . . . . 14 111 2.3.6. Buffer and State Table . . . . . . . . . . . . . . . 16 112 2.3.7. Commands and Replies . . . . . . . . . . . . . . . . 16 113 2.3.8. Lines . . . . . . . . . . . . . . . . . . . . . . . . 16 114 2.3.9. Message Content and Mail Data . . . . . . . . . . . . 16 115 2.3.10. Originator, Delivery, Relay, and Gateway Systems . . 17 116 2.3.11. Mailbox and Address . . . . . . . . . . . . . . . . . 17 117 2.4. General Syntax Principles and Transaction Model . . . . . 18 118 3. The SMTP Procedures: An Overview . . . . . . . . . . . . . . 19 119 3.1. Session Initiation . . . . . . . . . . . . . . . . . . . 20 120 3.2. Client Initiation . . . . . . . . . . . . . . . . . . . . 20 121 3.3. Mail Transactions . . . . . . . . . . . . . . . . . . . . 21 122 3.4. Forwarding for Address Correction or Updating . . . . . . 23 123 3.5. Commands for Debugging Addresses . . . . . . . . . . . . 24 124 3.5.1. Overview . . . . . . . . . . . . . . . . . . . . . . 24 125 3.5.2. VRFY Normal Response . . . . . . . . . . . . . . . . 27 126 3.5.3. Meaning of VRFY or EXPN Success Response . . . . . . 27 127 3.5.4. Semantics and Applications of EXPN . . . . . . . . . 28 128 3.6. Relaying and Mail Routing . . . . . . . . . . . . . . . . 28 129 3.6.1. Source Routes and Relaying . . . . . . . . . . . . . 28 130 3.6.2. Mail eXchange Records and Relaying . . . . . . . . . 29 131 3.6.3. Message Submission Servers as Relays . . . . . . . . 29 132 3.7. Mail Gatewaying . . . . . . . . . . . . . . . . . . . . . 30 133 3.7.1. Header Fields in Gatewaying . . . . . . . . . . . . . 30 134 3.7.2. Received Lines in Gatewaying . . . . . . . . . . . . 31 135 3.7.3. Addresses in Gatewaying . . . . . . . . . . . . . . . 31 136 3.7.4. Other Header Fields in Gatewaying . . . . . . . . . . 31 137 3.7.5. Envelopes in Gatewaying . . . . . . . . . . . . . . . 32 138 3.8. Terminating Sessions and Connections . . . . . . . . . . 32 139 3.9. Mailing Lists and Aliases . . . . . . . . . . . . . . . . 33 140 3.9.1. Alias . . . . . . . . . . . . . . . . . . . . . . . . 33 141 3.9.2. List . . . . . . . . . . . . . . . . . . . . . . . . 34 142 4. The SMTP Specifications . . . . . . . . . . . . . . . . . . . 34 143 4.1. SMTP Commands . . . . . . . . . . . . . . . . . . . . . . 34 144 4.1.1. Command Semantics and Syntax . . . . . . . . . . . . 34 145 4.1.2. Command Argument Syntax . . . . . . . . . . . . . . . 42 146 4.1.3. Address Literals . . . . . . . . . . . . . . . . . . 45 147 4.1.4. Order of Commands . . . . . . . . . . . . . . . . . . 46 148 4.1.5. Private-Use Commands . . . . . . . . . . . . . . . . 48 149 4.2. SMTP Replies . . . . . . . . . . . . . . . . . . . . . . 48 150 4.2.1. Reply Code Severities and Theory . . . . . . . . . . 50 151 4.2.2. Reply Codes by Function Groups . . . . . . . . . . . 52 152 4.2.3. Reply Codes in Numeric Order . . . . . . . . . . . . 54 153 4.2.4. Some specific code situations and relationships . . . 55 154 4.3. Sequencing of Commands and Replies . . . . . . . . . . . 57 155 4.3.1. Sequencing Overview . . . . . . . . . . . . . . . . . 57 156 4.3.2. Command-Reply Sequences . . . . . . . . . . . . . . . 58 157 4.4. Trace Information . . . . . . . . . . . . . . . . . . . . 60 158 4.5. Additional Implementation Issues . . . . . . . . . . . . 64 159 4.5.1. Minimum Implementation . . . . . . . . . . . . . . . 64 160 4.5.2. Transparency . . . . . . . . . . . . . . . . . . . . 65 161 4.5.3. Sizes and Timeouts . . . . . . . . . . . . . . . . . 65 162 4.5.4. Retry Strategies . . . . . . . . . . . . . . . . . . 69 163 4.5.5. Messages with a Null Reverse-Path . . . . . . . . . . 71 164 5. Address Resolution and Mail Handling . . . . . . . . . . . . 72 165 5.1. Locating the Target Host . . . . . . . . . . . . . . . . 72 166 5.2. IPv6 and MX Records . . . . . . . . . . . . . . . . . . . 74 167 6. Problem Detection and Handling . . . . . . . . . . . . . . . 75 168 6.1. Reliable Delivery and Replies by Email . . . . . . . . . 75 169 6.2. Unwanted, Unsolicited, and "Attack" Messages . . . . . . 76 170 6.3. Loop Detection . . . . . . . . . . . . . . . . . . . . . 77 171 6.4. Compensating for Irregularities . . . . . . . . . . . . . 77 172 7. Security Considerations . . . . . . . . . . . . . . . . . . . 78 173 7.1. Mail Security and Spoofing . . . . . . . . . . . . . . . 78 174 7.2. "Blind" Copies . . . . . . . . . . . . . . . . . . . . . 79 175 7.3. VRFY, EXPN, and Security . . . . . . . . . . . . . . . . 80 176 7.4. Mail Rerouting Based on the 251 and 551 Response 177 Codes . . . . . . . . . . . . . . . . . . . . . . . . . . 81 178 7.5. Information Disclosure in Announcements . . . . . . . . . 81 179 7.6. Information Disclosure in Trace Fields . . . . . . . . . 81 180 7.7. Information Disclosure in Message Forwarding . . . . . . 81 181 7.8. Resistance to Attacks . . . . . . . . . . . . . . . . . . 82 182 7.9. Scope of Operation of SMTP Servers . . . . . . . . . . . 82 183 8. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 82 184 9. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 84 185 10. References . . . . . . . . . . . . . . . . . . . . . . . . . 84 186 10.1. Normative References . . . . . . . . . . . . . . . . . . 84 187 10.2. Informative References . . . . . . . . . . . . . . . . . 85 188 Appendix A. TCP Transport Service . . . . . . . . . . . . . . . 90 189 Appendix B. Generating SMTP Commands from RFC 822 Header Fields 90 190 Appendix C. Source Routes . . . . . . . . . . . . . . . . . . . 91 191 Appendix D. Scenarios . . . . . . . . . . . . . . . . . . . . . 92 192 D.1. A Typical SMTP Transaction Scenario . . . . . . . . . . . 92 193 D.2. Aborted SMTP Transaction Scenario . . . . . . . . . . . . 93 194 D.3. Relayed Mail Scenario . . . . . . . . . . . . . . . . . . 94 195 D.4. Verifying and Sending Scenario . . . . . . . . . . . . . 95 196 Appendix E. Other Gateway Issues . . . . . . . . . . . . . . . . 96 197 Appendix F. Deprecated Features of RFC 821 . . . . . . . . . . . 96 198 F.1. TURN . . . . . . . . . . . . . . . . . . . . . . . . . . 96 199 F.2. Source Routing . . . . . . . . . . . . . . . . . . . . . 96 200 F.3. HELO . . . . . . . . . . . . . . . . . . . . . . . . . . 97 201 F.4. #-literals . . . . . . . . . . . . . . . . . . . . . . . 97 202 F.5. Dates and Years . . . . . . . . . . . . . . . . . . . . . 97 203 F.6. Sending versus Mailing . . . . . . . . . . . . . . . . . 97 204 Appendix G. Other Outstanding Issues . . . . . . . . . . . . . . 98 205 G.1. IP Address literals . . . . . . . . . . . . . . . . . . . 99 206 G.2. Repeated Use of EHLO . . . . . . . . . . . . . . . . . . 99 207 G.3. Meaning of "MTA" and Related Terminology . . . . . . . . 99 208 G.4. Originator, or Originating System, Authentication . . . . 100 209 G.5. Remove or deprecate the work-around from code 552 to 452 100 210 G.6. Clarify where the protocol stands with respect to 211 submission and TLS issues . . . . . . . . . . . . . . . . 100 212 G.7. Probably-substantive Discussion Topics Identified in 213 Other Ways . . . . . . . . . . . . . . . . . . . . . . . 100 214 G.7.1. Issues with 521, 554, and 556 codes . . . . . . . . . 100 215 G.7.2. SMTP Model, terminology, and relationship to RFC 5598 101 216 G.7.3. Resolvable FQDNs and private domain names . . . . . . 101 217 G.7.4. Possible clarification about mail transactions and 218 transaction state . . . . . . . . . . . . . . . . . . 101 219 G.7.5. Issues with mailing lists, aliases, and forwarding . 101 220 G.7.6. Requirements for domain name and/or IP address in 221 EHLO . . . . . . . . . . . . . . . . . . . . . . . . 101 222 G.7.7. Does the 'first digit only' and/or non-listed reply 223 code text need clarification? . . . . . . . . . . . . 101 224 G.7.8. Size limits . . . . . . . . . . . . . . . . . . . . . 101 225 G.7.9. Discussion of 'blind' copies and RCPT . . . . . . . . 102 226 G.7.10. Further clarifications needed to source routes? . . . 102 227 G.7.11. Should 1yz Be Revisited? . . . . . . . . . . . . . . 102 228 G.7.12. Review Timeout Specifications . . . . . . . . . . . . 102 229 G.7.13. Possible SEND, SAML, SOML Loose End . . . . . . . . . 102 230 G.8. Enhanced Reply Codes and DSNs . . . . . . . . . . . . . . 102 231 G.9. Revisiting Quoted Strings . . . . . . . . . . . . . . . . 103 232 G.10. Internationalization . . . . . . . . . . . . . . . . . . 103 233 G.11. SMTP Clients, Servers, Senders, and Receivers . . . . . . 104 234 G.12. Extension Keywords Starting in 'X-' . . . . . . . . . . . 104 235 G.13. Deprecating HELO . . . . . . . . . . . . . . . . . . . . 104 236 G.14. The FOR Clause in Trace Fields: Semantics, Security 237 Considerations, and Other Issues . . . . . . . . . . . . 105 238 Appendix H. RFC 5321 Errata Summary and Tentative Change Log . . 105 239 H.1. RFC 5321 Errata Summary . . . . . . . . . . . . . . . . . 105 240 H.2. Changes from RFC 5321 (published October 2008) to the 241 initial (-00) version of this draft . . . . . . . . . . . 107 242 H.3. Changes Among Versions of Rfc5321bis . . . . . . . . . . 108 243 H.3.1. Changes from draft-klensin-rfc5321bis-00 (posted 244 2012-12-02) to -01 . . . . . . . . . . . . . . . . . 108 245 H.3.2. Changes from draft-klensin-rfc5321bis-01 (20191203) 246 to -02 . . . . . . . . . . . . . . . . . . . . . . . 108 247 H.3.3. Changes from draft-klensin-rfc5321bis-02 (2019-12-27) 248 to -03 . . . . . . . . . . . . . . . . . . . . . . . 108 249 H.3.4. Changes from draft-klensin-rfc5321bis-03 (2020-07-02) 250 to draft-ietf-emailcore-rfc5321bis-00 . . . . . . . . 109 251 H.3.5. Changes from draft-ietf-emailcore-rfc5321bis-00 252 (2020-10-06) to -01 . . . . . . . . . . . . . . . . . 109 253 H.3.6. Changes from draft-ietf-emailcore-rfc5321bis-01 254 (2020-12-25) to -02 . . . . . . . . . . . . . . . . . 110 255 Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110 256 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 112 258 1. Introduction 260 1.1. Transport of Electronic Mail 262 The objective of the Simple Mail Transfer Protocol (SMTP) is to 263 transfer mail reliably and efficiently. 265 SMTP is independent of the particular transmission subsystem and 266 requires only a reliable ordered data stream channel. While this 267 document specifically discusses transport over TCP, other transports 268 are possible. Appendices to RFC 821 [3] describe some of them. 270 An important feature of SMTP is its capability to transport mail 271 across multiple networks, usually referred to as "SMTP mail relaying" 272 (see Section 3.6). A network consists of the mutually-TCP-accessible 273 hosts on the public Internet, the mutually-TCP-accessible hosts on a 274 firewall-isolated TCP/IP Intranet, or hosts in some other LAN or WAN 275 environment utilizing a non-TCP transport-level protocol. Using 276 SMTP, a process can transfer mail to another process on the same 277 network or to some other network via a relay or gateway process 278 accessible to both networks. 280 In this way, a mail message may pass through a number of intermediate 281 relay or gateway hosts on its path from sender to ultimate recipient. 282 The Mail eXchanger mechanisms of the domain name system (RFC 1035 283 [4], RFC 974 [15], and Section 5 of this document) are used to 284 identify the appropriate next-hop destination for a message being 285 transported. 287 1.2. History and Context for This Document 289 This document is a specification of the basic protocol for the 290 Internet electronic mail transport. It consolidates, updates and 291 clarifies, but does not add new or change existing functionality of 292 the following: 294 o the original SMTP (Simple Mail Transfer Protocol) specification of 295 RFC 821 [3], 297 o domain name system requirements and implications for mail 298 transport from RFC 1035 [4] and RFC 974 [15], 300 o the clarifications and applicability statements in RFC 1123 [5], 302 o the new error codes added by RFC 1846 [19] and later by RFC 7504 303 [48], obsoleting both of those documents, and 305 o material drawn from the SMTP Extension mechanisms in RFC 1869 306 [21]. 308 o Editorial and clarification changes to RFC 2821 [29] to bring that 309 specification to Draft Standard. 311 It obsoletes RFC 821, RFC 974, RFC 1869, and RFC 2821 and updates RFC 312 1123 (replacing the mail transport materials of RFC 1123). However, 313 RFC 821 specifies some features that were not in significant use in 314 the Internet by the mid-1990s and (in appendices) some additional 315 transport models. Those sections are omitted here in the interest of 316 clarity and brevity; readers needing them should refer to RFC 821. 318 It also includes some additional material from RFC 1123 that required 319 amplification. This material has been identified in multiple ways, 320 mostly by tracking flaming on various lists and newsgroups and 321 problems of unusual readings or interpretations that have appeared as 322 the SMTP extensions have been deployed. Where this specification 323 moves beyond consolidation and actually differs from earlier 324 documents, it supersedes them technically as well as textually. 326 Although SMTP was designed as a mail transport and delivery protocol, 327 this specification also contains information that is important to its 328 use as a "mail submission" protocol, as recommended for Post Office 329 Protocol (POP) (RFC 937 [13], RFC 1939 [22]) and IMAP (RFC 3501 330 [36]). In general, the separate mail submission protocol specified 331 in RFC 6409 [42] is now preferred to direct use of SMTP; more 332 discussion of that subject appears in that document. 334 Section 2.3 provides definitions of terms specific to this document. 335 Except when the historical terminology is necessary for clarity, this 336 document uses the current 'client' and 'server' terminology to 337 identify the sending and receiving SMTP processes, respectively. 339 A companion document, RFC 5322 [11], discusses message header 340 sections and bodies and specifies formats and structures for them. 342 1.3. Document Conventions 344 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 345 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 346 document are to be interpreted as described in RFC 2119 [1]. As each 347 of these terms was intentionally and carefully chosen to improve the 348 interoperability of email, each use of these terms is to be treated 349 as a conformance requirement. 351 Because this document has a long history and to avoid the risk of 352 various errors and of confusing readers and documents that point to 353 this one, most examples and the domain names they contain are 354 preserved from RFC 2821. Readers are cautioned that these are 355 illustrative examples that should not actually be used in either code 356 or configuration files. 358 2. The SMTP Model 360 [[CREF2: [5321bis] [[Editor's Note: There have been extensive and 361 repeated discussions on the SMTP and IETF lists about whether this 362 document should say something about hop-by-hop (MTA-to-MTA) SMTP 363 authentication and, if so, what?? Note that end to end message 364 authentication is almost certainly out of scope for SMTP.]]]] 366 2.1. Basic Structure 368 The SMTP design can be pictured as: 370 +----------+ +----------+ 371 +------+ | | | | 372 | User |<-->| | SMTP | | 373 +------+ | Client- |Commands/Replies| Server- | 374 +------+ | SMTP |<-------------->| SMTP | +------+ 375 | File |<-->| | and Mail | |<-->| File | 376 |System| | | | | |System| 377 +------+ +----------+ +----------+ +------+ 378 SMTP client SMTP server 380 When an SMTP client has a message to transmit, it establishes a two- 381 way transmission channel to an SMTP server. The responsibility of an 382 SMTP client is to transfer mail messages to one or more SMTP servers, 383 or report its failure to do so. 385 The means by which a mail message is presented to an SMTP client, and 386 how that client determines the identifier(s) ("names") of the 387 domain(s) to which mail messages are to be transferred, are local 388 matters. They are not addressed by this document. In some cases, 389 the designated domain(s), or those determined by an SMTP client, will 390 identify the final destination(s) of the mail message. In other 391 cases, common with SMTP clients associated with implementations of 392 the POP (RFC 937 [13], RFC 1939 [22]) or IMAP (RFC 3501 [36]) 393 protocols, or when the SMTP client is inside an isolated transport 394 service environment, the domain determined will identify an 395 intermediate destination through which all mail messages are to be 396 relayed. SMTP clients that transfer all traffic regardless of the 397 target domains associated with the individual messages, or that do 398 not maintain queues for retrying message transmissions that initially 399 cannot be completed, may otherwise conform to this specification but 400 are not considered fully-capable. Fully-capable SMTP 401 implementations, including the relays used by these less capable 402 ones, and their destinations, are expected to support all of the 403 queuing, retrying, and alternate address functions discussed in this 404 specification. In many situations and configurations, the less- 405 capable clients discussed above SHOULD be using the message 406 submission protocol (RFC 6409 [42]) rather than SMTP. 408 The means by which an SMTP client, once it has determined a target 409 domain, determines the identity of an SMTP server to which a copy of 410 a message is to be transferred, and then performs that transfer, are 411 covered by this document. To effect a mail transfer to an SMTP 412 server, an SMTP client establishes a two-way transmission channel to 413 that SMTP server. An SMTP client determines the address of an 414 appropriate host running an SMTP server by resolving a destination 415 domain name to either an intermediate Mail eXchanger host or a final 416 target host. 418 An SMTP server may be either the ultimate destination or an 419 intermediate "relay" (that is, it may assume the role of an SMTP 420 client after receiving the message) or "gateway" (that is, it may 421 transport the message further using some protocol other than SMTP). 422 SMTP commands are generated by the SMTP client and sent to the SMTP 423 server. SMTP replies are sent from the SMTP server to the SMTP 424 client in response to the commands. 426 In other words, message transfer can occur in a single connection 427 between the original SMTP-sender and the final SMTP-recipient, or can 428 occur in a series of hops through intermediary systems. In either 429 case, once the server has issued a success response at the end of the 430 mail data, a formal handoff of responsibility for the message occurs: 431 the protocol requires that a server MUST accept responsibility for 432 either delivering the message or properly reporting the failure to do 433 so (see Sections 6.1, 6.2, and 7.8, below). 435 Once the transmission channel is established and initial handshaking 436 is completed, the SMTP client normally initiates a mail transaction. 437 Such a transaction consists of a series of commands to specify the 438 originator and destination of the mail and transmission of the 439 message content (including any lines in the header section or other 440 structure) itself. When the same message is sent to multiple 441 recipients, this protocol encourages the transmission of only one 442 copy of the data for all recipients at the same destination (or 443 intermediate relay) host. 445 The server responds to each command with a reply; replies may 446 indicate that the command was accepted, that additional commands are 447 expected, or that a temporary or permanent error condition exists. 448 Commands specifying the sender or recipients may include server- 449 permitted SMTP service extension requests, as discussed in 450 Section 2.2. The dialog is purposely lock-step, one-at-a-time, 451 although this can be modified by mutually agreed upon extension 452 requests such as command pipelining (RFC 2920 [30]). 454 Once a given mail message has been transmitted, the client may either 455 request that the connection be shut down or may initiate other mail 456 transactions. In addition, an SMTP client may use a connection to an 457 SMTP server for ancillary services such as verification of email 458 addresses or retrieval of mailing list subscriber addresses. 460 As suggested above, this protocol provides mechanisms for the 461 transmission of mail. Historically, this transmission normally 462 occurred directly from the sending user's host to the receiving 463 user's host when the two hosts are connected to the same transport 464 service. When they are not connected to the same transport service, 465 transmission occurs via one or more relay SMTP servers. A very 466 common case in the Internet today involves submission of the original 467 message to an intermediate, "message submission" server, which is 468 similar to a relay but has some additional properties; such servers 469 are discussed in Section 2.3.10 and at some length in RFC 6409 [42]. 470 An intermediate host that acts as either an SMTP relay or as a 471 gateway into some other transmission environment is usually selected 472 through the use of the domain name service (DNS) Mail eXchanger 473 mechanism. Explicit "source" routing (see Section 5 and Appendix C 474 and Appendix F.2) SHOULD NOT be used. [[CREF3: [5321bis] JcK 475 20090123 - redundant sentence removed.]] 477 2.2. The Extension Model 479 2.2.1. Background 481 In an effort that started in 1990, approximately a decade after RFC 482 821 was completed, the protocol was modified with a "service 483 extensions" model that permits the client and server to agree to 484 utilize shared functionality beyond the original SMTP requirements. 485 The SMTP extension mechanism defines a means whereby an extended SMTP 486 client and server may recognize each other, and the server can inform 487 the client as to the service extensions that it supports. 489 Contemporary SMTP implementations MUST support the basic extension 490 mechanisms. For instance, servers MUST support the EHLO command even 491 if they do not implement any specific extensions and clients SHOULD 492 preferentially utilize EHLO rather than HELO. (However, for 493 compatibility with older conforming implementations, SMTP clients and 494 servers MUST support the original HELO mechanisms as a fallback.) 495 Unless the different characteristics of HELO must be identified for 496 interoperability purposes, this document discusses only EHLO. 498 SMTP is widely deployed and high-quality implementations have proven 499 to be very robust. However, the Internet community now considers 500 some services to be important that were not anticipated when the 501 protocol was first designed. If support for those services is to be 502 added, it must be done in a way that permits older implementations to 503 continue working acceptably. The extension framework consists of: 505 o The SMTP command EHLO, superseding the earlier HELO, 507 o a registry of SMTP service extensions, 509 o additional parameters to the SMTP MAIL and RCPT commands, and 511 o optional replacements for commands defined in this protocol, such 512 as for DATA in non-ASCII transmissions (RFC 3030 [32]). 514 SMTP's strength comes primarily from its simplicity. Experience with 515 many protocols has shown that protocols with few options tend towards 516 ubiquity, whereas protocols with many options tend towards obscurity. 518 Each and every extension, regardless of its benefits, must be 519 carefully scrutinized with respect to its implementation, deployment, 520 and interoperability costs. In many cases, the cost of extending the 521 SMTP service will likely outweigh the benefit. 523 2.2.2. Definition and Registration of Extensions 525 The IANA maintains a registry of SMTP service extensions. A 526 corresponding EHLO keyword value is associated with each extension. 527 Each service extension registered with the IANA must be defined in a 528 formal Standards-Track or IESG-approved Experimental protocol 529 document. The definition must include: 531 o the textual name of the SMTP service extension; 533 o the EHLO keyword value associated with the extension; 535 o the syntax and possible values of parameters associated with the 536 EHLO keyword value; 538 o any additional SMTP verbs associated with the extension 539 (additional verbs will usually be, but are not required to be, the 540 same as the EHLO keyword value); 542 o any new parameters the extension associates with the MAIL or RCPT 543 verbs; 545 o a description of how support for the extension affects the 546 behavior of a server and client SMTP; and 548 o the increment by which the extension is increasing the maximum 549 length of the commands MAIL and/or RCPT, over that specified in 550 this Standard. 552 In addition, any EHLO keyword value starting with an upper or lower 553 case "X" refers to a local SMTP service extension used exclusively 554 through bilateral agreement. Keywords beginning with "X" MUST NOT be 555 used in a registered service extension. Conversely, keyword values 556 presented in the EHLO response that do not begin with "X" MUST 557 correspond to a Standard, Standards-Track, or IESG-approved 558 Experimental SMTP service extension registered with IANA. A 559 conforming server MUST NOT offer non-"X"-prefixed keyword values that 560 are not described in a registered extension. 562 Additional verbs and parameter names are bound by the same rules as 563 EHLO keywords; specifically, verbs beginning with "X" are local 564 extensions that may not be registered or standardized. Conversely, 565 verbs not beginning with "X" must always be registered. 567 2.2.3. Special Issues with Extensions 569 Extensions that change fairly basic properties of SMTP operation are 570 permitted. The text in other sections of this document must be 571 understood in that context. In particular, extensions can change the 572 minimum limits specified in Section 4.5.3, can change the ASCII 573 character set requirement as mentioned above, or can introduce some 574 optional modes of message handling. 576 In particular, if an extension implies that the delivery path 577 normally supports special features of that extension, and an 578 intermediate SMTP system finds a next hop that does not support the 579 required extension, it MAY choose, based on the specific extension 580 and circumstances, to requeue the message and try later and/or try an 581 alternate MX host. If this strategy is employed, the timeout to fall 582 back to an unextended format (if one is available) SHOULD be less 583 than the normal timeout for bouncing as undeliverable (e.g., if 584 normal timeout is three days, the requeue timeout before attempting 585 to transmit the mail without the extension might be one day). 587 2.3. SMTP Terminology 589 2.3.1. Mail Objects 591 SMTP transports a mail object. A mail object contains an envelope 592 and content. 594 The SMTP envelope is sent as a series of SMTP protocol units 595 (described in Section 3). It consists of an originator address (to 596 which error reports should be directed), one or more recipient 597 addresses, and optional protocol extension material. Historically, 598 variations on the reverse-path (originator) address specification 599 command (MAIL) could be used to specify alternate delivery modes, 600 such as immediate display; those variations have now been deprecated 601 (see Appendix F and Appendix F.6). 603 The SMTP content is sent in the SMTP DATA protocol unit and has two 604 parts: the header section and the body. If the content conforms to 605 other contemporary standards, the header section consists of a 606 collection of header fields, each consisting of a header name, a 607 colon, and data, structured as in the message format specification 608 (RFC 5322 [11]); the body, if structured, is defined according to 609 MIME (RFC 2045 [24]). The content is textual in nature, expressed 610 using the US-ASCII repertoire [2]. Although SMTP extensions (such as 611 "8BITMIME", RFC 6152 [47]) may relax this restriction for the content 612 body, the content header fields are always encoded using the US-ASCII 613 repertoire. Two MIME extensions (RFC 2047 [25] and RFC 2231 [28]) 614 define an algorithm for representing header values outside the US- 615 ASCII repertoire, while still encoding them using the US-ASCII 616 repertoire. 618 2.3.2. Senders and Receivers 620 In RFC 821, the two hosts participating in an SMTP transaction were 621 described as the "SMTP-sender" and "SMTP-receiver". This document 622 has been changed to reflect current industry terminology and hence 623 refers to them as the "SMTP client" (or sometimes just "the client") 624 and "SMTP server" (or just "the server"), respectively. Since a 625 given host may act both as server and client in a relay situation, 626 "receiver" and "sender" terminology is still used where needed for 627 clarity. 629 2.3.3. Mail Agents and Message Stores 631 Additional mail system terminology became common after RFC 821 was 632 published and, where convenient, is used in this specification. In 633 particular, SMTP servers and clients provide a mail transport service 634 and therefore act as "Mail Transfer Agents" (MTAs). "Mail User 635 Agents" (MUAs or UAs) are normally thought of as the sources and 636 targets of mail. At the source, an MUA might collect mail to be 637 transmitted from a user and hand it off to an MTA; the final 638 ("delivery") MTA would be thought of as handing the mail off to an 639 MUA (or at least transferring responsibility to it, e.g., by 640 depositing the message in a "message store"). However, while these 641 terms are used with at least the appearance of great precision in 642 other environments, the implied boundaries between MUAs and MTAs 643 often do not accurately match common, and conforming, practices with 644 Internet mail. Hence, the reader should be cautious about inferring 645 the strong relationships and responsibilities that might be implied 646 if these terms were used elsewhere. 648 2.3.4. Host 650 For the purposes of this specification, a host is a computer system 651 attached to the Internet (or, in some cases, to a private TCP/IP 652 network) and supporting the SMTP protocol. Hosts are known by names 653 (see the next section); they SHOULD NOT be identified by numerical 654 addresses, i.e., by address literals as described in Section 4.1.2. 656 2.3.5. Domain Names 658 A domain name (or often just a "domain") consists of one or more 659 components, separated by dots if more than one appears. In the case 660 of a top-level domain used by itself in an email address, a single 661 string is used without any dots. This makes the requirement, 662 described in more detail below, that only fully-qualified domain 663 names appear in SMTP transactions on the public Internet, 664 particularly important where top-level domains are involved. These 665 components ("labels" in DNS terminology, RFC 1035 [4]) are restricted 666 for SMTP purposes to consist of a sequence of letters, digits, and 667 hyphens drawn from the ASCII character set [2] and conforming to what 668 RFC 1035 Section 2.3.1 calls the "preferred name syntax". Domain 669 names are used as names of hosts and of other entities in the domain 670 name hierarchy. For example, a domain may refer to an alias (label 671 of a CNAME RR) or the label of Mail eXchanger records to be used to 672 deliver mail instead of representing a host name. See RFC 1035 [4] 673 and Section 5 of this specification. 675 The domain name, as described in this document and in RFC 1035 [4], 676 is the entire, fully-qualified name (often referred to as an "FQDN"). 677 A domain name that is not in FQDN form is no more than a local alias. 678 Local aliases MUST NOT appear in any SMTP transaction. 680 Only resolvable, fully-qualified domain names (FQDNs) are permitted 681 when domain names are used in SMTP. 682 [[CREF4: [[5321bis Editor's Note: does "in the public DNS" or 683 equivalent need to be added to "resolvable"???]]]] 684 In other words, names that can be resolved to MX RRs or address 685 (i.e., A or AAAA) RRs (as discussed in Section 5) are permitted, as 686 are CNAME RRs whose targets can be resolved, in turn, to MX or 687 address RRs. 688 [[CREF5: [[5321bis Editor's Note: it is not clear whether "In other 689 words" really meant "for example" or it is was intended that the only 690 labels permitted are those that own records in one of the above RR 691 types]]]] 692 [[CREF6: [[5321bis Editor's Note: More generally, does this section 693 need work to clarify the relationship to private domain names 694 (discussed on SMTP list starting 2013-03-26)]]]] 695 Local nicknames or unqualified names MUST NOT be used. There are two 696 exceptions to the rule requiring FQDNs: 698 o The domain name given in the EHLO command MUST be either a primary 699 host name (a domain name that resolves to an address RR) or, if 700 the host has no name, an address literal, as described in 701 Section 4.1.3 and discussed further in the EHLO discussion of 702 Section 4.1.4. 704 o The reserved mailbox name "postmaster" may be used in a RCPT 705 command without domain qualification (see Section 4.1.1.3) and 706 MUST be accepted if so used. 708 2.3.6. Buffer and State Table 710 SMTP sessions are stateful, with both parties carefully maintaining a 711 common view of the current state. In this document, we model this 712 state by a virtual "buffer" and a "state table" on the server that 713 may be used by the client to, for example, "clear the buffer" or 714 "reset the state table", causing the information in the buffer to be 715 discarded and the state to be returned to some previous state. 717 2.3.7. Commands and Replies 719 SMTP commands and, unless altered by a service extension, message 720 data, are transmitted from the sender to the receiver via the 721 transmission channel in "lines". 723 An SMTP reply is an acknowledgment (positive or negative) sent in 724 "lines" from receiver to sender via the transmission channel in 725 response to a command. The general form of a reply is a numeric 726 completion code (indicating failure or success) usually followed by a 727 text string. The codes are for use by programs and the text is 728 usually intended for human users. RFC 3463 [34], specifies further 729 structuring of the reply strings, including the use of supplemental 730 and more specific completion codes (see also RFC 5248 [46]). 732 2.3.8. Lines 734 Lines consist of zero or more data characters terminated by the 735 sequence ASCII character "CR" (hex value 0D) followed immediately by 736 ASCII character "LF" (hex value 0A). This termination sequence is 737 denoted as in this document. Conforming implementations MUST 738 NOT recognize or generate any other character or character sequence 739 as a line terminator. Limits MAY be imposed on line lengths by 740 servers (see Section 4). 742 In addition, the appearance of "bare" "CR" or "LF" characters in text 743 (i.e., either without the other) has a long history of causing 744 problems in mail implementations and applications that use the mail 745 system as a tool. SMTP client implementations MUST NOT transmit 746 these characters except when they are intended as line terminators 747 and then MUST, as indicated above, transmit them only as a 748 sequence. 750 2.3.9. Message Content and Mail Data 752 The terms "message content" and "mail data" are used interchangeably 753 in this document to describe the material transmitted after the DATA 754 command is accepted and before the end of data indication is 755 transmitted. Message content includes the message header section and 756 the possibly structured message body. In the absence of extensions, 757 both are required to be ASCII (see Section 2.3.1). The MIME 758 specification (RFC 2045 [24]) provides the standard mechanisms for 759 structured message bodies. 761 2.3.10. Originator, Delivery, Relay, and Gateway Systems 763 This specification makes a distinction among four types of SMTP 764 systems, based on the role those systems play in transmitting 765 electronic mail. An "originating" system (sometimes called an SMTP 766 originator) introduces mail into the Internet or, more generally, 767 into a transport service environment. A "delivery" SMTP system is 768 one that receives mail from a transport service environment and 769 passes it to a mail user agent or deposits it in a message store that 770 a mail user agent is expected to subsequently access. A "relay" SMTP 771 system (usually referred to just as a "relay") receives mail from an 772 SMTP client and transmits it, without modification to the message 773 data other than adding trace information, to another SMTP server for 774 further relaying or for delivery. 776 A "gateway" SMTP system (usually referred to just as a "gateway") 777 receives mail from a client system in one transport environment and 778 transmits it to a server system in another transport environment. 779 Differences in protocols or message semantics between the transport 780 environments on either side of a gateway may require that the gateway 781 system perform transformations to the message that are not permitted 782 to SMTP relay systems. For the purposes of this specification, 783 firewalls that rewrite addresses should be considered as gateways, 784 even if SMTP is used on both sides of them (see RFC 2979 [31]). 785 [[CREF7: [5321bis] [[Note in draft/Placeholder: There has been a 786 request to expand this section, possibly into a more extensive model 787 of Internet mail. Comments from others solicited. In particular, 788 does RFC 5598 make that suggestion OBE?]] ]] 790 2.3.11. Mailbox and Address 792 As used in this specification, an "address" is a character string 793 that identifies a user to whom mail will be sent or a location into 794 which mail will be deposited. The term "mailbox" refers to that 795 depository. The two terms are typically used interchangeably unless 796 the distinction between the location in which mail is placed (the 797 mailbox) and a reference to it (the address) is important. An 798 address normally consists of user and domain specifications. The 799 standard mailbox naming convention is defined to be "local- 800 part@domain"; contemporary usage permits a much broader set of 801 applications than simple "user names". Consequently, and due to a 802 long history of problems when intermediate hosts have attempted to 803 optimize transport by modifying them, the local-part MUST be 804 interpreted and assigned semantics only by the host specified in the 805 domain part of the address. 807 2.4. General Syntax Principles and Transaction Model 809 SMTP commands and replies have a rigid syntax. All commands begin 810 with a command verb. All replies begin with a three digit numeric 811 code. In some commands and replies, arguments are required following 812 the verb or reply code. Some commands do not accept arguments (after 813 the verb), and some reply codes are followed, sometimes optionally, 814 by free form text. In both cases, where text appears, it is 815 separated from the verb or reply code by a space character. Complete 816 definitions of commands and replies appear in Section 4. 818 Verbs and argument values (e.g., "TO:" or "to:" in the RCPT command 819 and extension name keywords) are not case sensitive, with the sole 820 exception in this specification of a mailbox local-part (SMTP 821 Extensions may explicitly specify case-sensitive elements). That is, 822 a command verb, an argument value other than a mailbox local-part, 823 and free form text MAY be encoded in upper case, lower case, or any 824 mixture of upper and lower case with no impact on its meaning. The 825 local-part of a mailbox MUST BE treated as case sensitive. 826 Therefore, SMTP implementations MUST take care to preserve the case 827 of mailbox local-parts. In particular, for some hosts, the user 828 "smith" is different from the user "Smith". However, exploiting the 829 case sensitivity of mailbox local-parts impedes interoperability and 830 is discouraged. Mailbox domains follow normal DNS rules and are 831 hence not case sensitive. 833 A few SMTP servers, in violation of this specification (and RFC 821) 834 require that command verbs be encoded by clients in upper case. 835 Implementations MAY wish to employ this encoding to accommodate those 836 servers. 838 The argument clause consists of a variable-length character string 839 ending with the end of the line, i.e., with the character sequence 840 . The receiver will take no action until this sequence is 841 received. 843 The syntax for each command is shown with the discussion of that 844 command. Common elements and parameters are shown in Section 4.1.2. 846 Commands and replies are composed of characters from the ASCII 847 character set [2]. When the transport service provides an 8-bit byte 848 (octet) transmission channel, each 7-bit character is transmitted, 849 right justified, in an octet with the high-order bit cleared to zero. 850 More specifically, the unextended SMTP service provides 7-bit 851 transport only. An originating SMTP client that has not successfully 852 negotiated an appropriate extension with a particular server (see the 853 next paragraph) MUST NOT transmit messages with information in the 854 high-order bit of octets. If such messages are transmitted in 855 violation of this rule, receiving SMTP servers MAY clear the high- 856 order bit or reject the message as invalid. In general, a relay SMTP 857 SHOULD assume that the message content it has received is valid and, 858 assuming that the envelope permits doing so, relay it without 859 inspecting that content. Of course, if the content is mislabeled and 860 the data path cannot accept the actual content, this may result in 861 the ultimate delivery of a severely garbled message to the recipient. 862 Delivery SMTP systems MAY reject such messages, or return them as 863 undeliverable, rather than deliver them. In the absence of a server- 864 offered extension explicitly permitting it, a sending SMTP system is 865 not permitted to send envelope commands in any character set other 866 than US-ASCII. Receiving systems SHOULD reject such commands, 867 normally using "500 syntax error - invalid character" replies. 869 8-bit message content transmission MAY be requested of the server by 870 a client using extended SMTP facilities, notably the "8BITMIME" 871 extension, RFC 6152 [47]. 8BITMIME SHOULD be supported by SMTP 872 servers. However, it MUST NOT be construed as authorization to 873 transmit unrestricted 8-bit material, nor does 8BITMIME authorize 874 transmission of any envelope material in other than ASCII. 8BITMIME 875 MUST NOT be requested by senders for material with the high bit on 876 that is not in MIME format with an appropriate content-transfer 877 encoding; servers MAY reject such messages. 879 The metalinguistic notation used in this document corresponds to the 880 "Augmented BNF" used in other Internet mail system documents. The 881 reader who is not familiar with that syntax should consult the ABNF 882 specification in RFC 5234 [10]. Metalanguage terms used in running 883 text are surrounded by pointed brackets (e.g., ) for clarity. 884 The reader is cautioned that the grammar expressed in the 885 metalanguage is not comprehensive. There are many instances in which 886 provisions in the text constrain or otherwise modify the syntax or 887 semantics implied by the grammar. 889 3. The SMTP Procedures: An Overview 891 This section contains descriptions of the procedures used in SMTP: 892 session initiation, mail transaction, forwarding mail, verifying 893 mailbox names and expanding mailing lists, and opening and closing 894 exchanges. Comments on relaying, a note on mail domains, and a 895 discussion of changing roles are included at the end of this section. 896 Several complete scenarios are presented in Appendix D. 898 3.1. Session Initiation 900 An SMTP session is initiated when a client opens a connection to a 901 server and the server responds with an opening message. 903 SMTP server implementations MAY include identification of their 904 software and version information in the connection greeting reply 905 after the 220 code, a practice that permits more efficient isolation 906 and repair of any problems. Implementations MAY make provision for 907 SMTP servers to disable the software and version announcement where 908 it causes security concerns. While some systems also identify their 909 contact point for mail problems, this is not a substitute for 910 maintaining the required "postmaster" address (see Section 4). 912 The SMTP protocol allows a server to formally reject a mail session 913 while still allowing the initial connection as follows: a 554 914 response MAY be given in the initial connection opening message 915 instead of the 220. A server taking this approach MUST still wait 916 for the client to send a QUIT (see Section 4.1.1.10) before closing 917 the connection and SHOULD respond to any intervening commands with 918 "503 bad sequence of commands". Since an attempt to make an SMTP 919 connection to such a system is probably in error, a server returning 920 a 554 response on connection opening SHOULD provide enough 921 information in the reply text to facilitate debugging of the sending 922 system. 924 3.2. Client Initiation 926 Once the server has sent the greeting (welcoming) message and the 927 client has received it, the client normally sends the EHLO command to 928 the server, indicating the client's identity. In addition to opening 929 the session, use of EHLO indicates that the client is able to process 930 service extensions and requests that the server provide a list of the 931 extensions it supports. Older SMTP systems that are unable to 932 support service extensions, and contemporary clients that do not 933 require service extensions in the mail session being initiated, MAY 934 use HELO instead of EHLO. Servers MUST NOT return the extended EHLO- 935 style response to a HELO command. For a particular connection 936 attempt, if the server returns a "command not recognized" response to 937 EHLO, the client SHOULD be able to fall back and send HELO. 939 In the EHLO command, the host sending the command identifies itself; 940 the command may be interpreted as saying "Hello, I am " (and, 941 in the case of EHLO, "and I support service extension requests"). 943 3.3. Mail Transactions 945 There are three steps to SMTP mail transactions. The transaction 946 starts with a MAIL command that gives the sender identification. (In 947 general, the MAIL command may be sent only when no mail transaction 948 is in progress; see Section 4.1.4.) A series of one or more RCPT 949 commands follows, giving the receiver information. Then, a DATA 950 command initiates transfer of the mail data and is terminated by the 951 "end of mail" data indicator, which also confirms the transaction. 953 Mail transactions are also terminated by the RSET command 954 (Section 4.1.1.5), the sending of an EHLO command (Section 3.2), or 955 the sending of a QUIT command (Section 3.8) which terminates both any 956 active mail transaction and the SMTP connection. 958 The first step in the procedure is the MAIL command. 960 MAIL FROM: [SP ] 962 This command tells the SMTP-receiver that a new mail transaction is 963 starting and to reset all its state tables and buffers, including any 964 recipients or mail data. The portion of the first or 965 only argument contains the source mailbox (between "<" and ">" 966 brackets), which can be used to report errors (see Section 4.2 for a 967 discussion of error reporting). If accepted, the SMTP server returns 968 a "250 OK" reply. If the mailbox specification is not acceptable for 969 some reason, the server MUST return a reply indicating whether the 970 failure is permanent (i.e., will occur again if the client tries to 971 send the same address again) or temporary (i.e., the address might be 972 accepted if the client tries again later). Despite the apparent 973 scope of this requirement, there are circumstances in which the 974 acceptability of the reverse-path may not be determined until one or 975 more forward-paths (in RCPT commands) can be examined. In those 976 cases, the server MAY reasonably accept the reverse-path (with a 250 977 reply) and then report problems after the forward-paths are received 978 and examined. Normally, failures produce 550 or 553 replies. 980 Historically, the was permitted to contain more than 981 just a mailbox; however, contemporary systems SHOULD NOT use source 982 routing (see Appendix C). 984 The optional are associated with negotiated SMTP 985 service extensions (see Section 2.2). 987 The second step in the procedure is the RCPT command. This step of 988 the procedure can be repeated any number of times. 990 RCPT TO: [ SP ] 992 The first or only argument to this command includes a forward-path 993 (normally a mailbox local-part and domain, always surrounded by "<" 994 and ">" brackets) identifying one recipient. If accepted, the SMTP 995 server returns a "250 OK" reply and stores the forward-path. If the 996 recipient is known not to be a deliverable address, the SMTP server 997 returns a 550 reply, typically with a string such as "no such user - 998 " and the mailbox name (other circumstances and reply codes are 999 possible). 1001 The can contain more than just a mailbox. 1002 Historically, the was permitted to contain a source 1003 routing list of hosts and the destination mailbox; however, 1004 contemporary SMTP clients SHOULD NOT utilize source routes (see 1005 Appendix C). Servers MUST be prepared to encounter a list of source 1006 routes in the forward-path, but they SHOULD ignore the routes or MAY 1007 decline to support the relaying they imply. Similarly, servers MAY 1008 decline to accept mail that is destined for other hosts or systems. 1009 These restrictions make a server useless as a relay for clients that 1010 do not support full SMTP functionality. Consequently, restricted- 1011 capability clients MUST NOT assume that any SMTP server on the 1012 Internet can be used as their mail processing (relaying) site. If a 1013 RCPT command appears without a previous MAIL command, the server MUST 1014 return a 503 "Bad sequence of commands" response. The optional 1015 are associated with negotiated SMTP service 1016 extensions (see Section 2.2). [[CREF8: [5321bis] JcK Note for 1017 2821ter (5321bis): this section would be improved by being more 1018 specific about where mail transactions begin and end and then talking 1019 about "transaction state" here, rather than specific prior commands. 1020 --JcK]] 1022 Since it has been a common source of errors, it is worth noting that 1023 spaces are not permitted on either side of the colon following FROM 1024 in the MAIL command or TO in the RCPT command. The syntax is exactly 1025 as given above. 1027 The third step in the procedure is the DATA command (or some 1028 alternative specified in a service extension). 1030 DATA 1032 If accepted, the SMTP server returns a 354 Intermediate reply and 1033 considers all succeeding lines up to but not including the end of 1034 mail data indicator to be the message text. When the end of text is 1035 successfully received and stored, the SMTP-receiver sends a "250 OK" 1036 reply. 1038 Since the mail data is sent on the transmission channel, the end of 1039 mail data must be indicated so that the command and reply dialog can 1040 be resumed. SMTP indicates the end of the mail data by sending a 1041 line containing only a "." (period or full stop). A transparency 1042 procedure is used to prevent this from interfering with the user's 1043 text (see Section 4.5.2). 1045 The end of mail data indicator also confirms the mail transaction and 1046 tells the SMTP server to now process the stored recipients and mail 1047 data. If accepted, the SMTP server returns a "250 OK" reply. The 1048 DATA command can fail at only two points in the protocol exchange: 1050 If there was no MAIL, or no RCPT, command, or all such commands were 1051 rejected, the server MAY return a "command out of sequence" (503) or 1052 "no valid recipients" (554) reply in response to the DATA command. 1053 If one of those replies (or any other 5yz reply) is received, the 1054 client MUST NOT send the message data; more generally, message data 1055 MUST NOT be sent unless a 354 reply is received. 1057 If the verb is initially accepted and the 354 reply issued, the DATA 1058 command should fail only if the mail transaction was incomplete (for 1059 example, no recipients), if resources were unavailable (including, of 1060 course, the server unexpectedly becoming unavailable), or if the 1061 server determines that the message should be rejected for policy or 1062 other reasons. 1064 However, in practice, some servers do not perform recipient 1065 verification until after the message text is received. These servers 1066 SHOULD treat a failure for one or more recipients as a "subsequent 1067 failure" and return a mail message as discussed in Section 6 and, in 1068 particular, in Section 6.1. Using a "550 mailbox not found" (or 1069 equivalent) reply code after the data are accepted makes it difficult 1070 or impossible for the client to determine which recipients failed. 1072 When the RFC 822 format ([12], [11]) is being used, the mail data 1073 include the header fields such as those named Date, Subject, To, Cc, 1074 and From. Server SMTP systems SHOULD NOT reject messages based on 1075 perceived defects in the RFC 822 or MIME (RFC 2045 [24]) message 1076 header section or message body. In particular, they MUST NOT reject 1077 messages in which the numbers of Resent-header fields do not match or 1078 Resent-to appears without Resent-from and/or Resent-date. 1080 Mail transaction commands MUST be used in the order discussed above. 1082 3.4. Forwarding for Address Correction or Updating 1084 Forwarding support is most often required to consolidate and simplify 1085 addresses within, or relative to, some enterprise and less frequently 1086 to establish addresses to link a person's prior address with a 1087 current one. Silent forwarding of messages (without server 1088 notification to the sender), for security or non-disclosure purposes, 1089 is common in the contemporary Internet. 1091 In both the enterprise and the "new address" cases, information 1092 hiding (and sometimes security) considerations argue against exposure 1093 of the "final" address through the SMTP protocol as a side effect of 1094 the forwarding activity. This may be especially important when the 1095 final address may not even be reachable by the sender. Consequently, 1096 the "forwarding" mechanisms described in Section 3.2 of RFC 821, and 1097 especially the 251 (corrected destination) and 551 reply codes from 1098 RCPT must be evaluated carefully by implementers and, when they are 1099 available, by those configuring systems (see also Section 7.4). 1101 In particular: 1103 o Servers MAY forward messages when they are aware of an address 1104 change. When they do so, they MAY either provide address-updating 1105 information with a 251 code, or may forward "silently" and return 1106 a 250 code. However, if a 251 code is used, they MUST NOT assume 1107 that the client will actually update address information or even 1108 return that information to the user. 1110 Alternately, 1112 o Servers MAY reject messages or return them as non-deliverable when 1113 they cannot be delivered precisely as addressed. When they do so, 1114 they MAY either provide address-updating information with a 551 1115 code, or may reject the message as undeliverable with a 550 code 1116 and no address-specific information. However, if a 551 code is 1117 used, they MUST NOT assume that the client will actually update 1118 address information or even return that information to the user. 1120 SMTP server implementations that support the 251 and/or 551 reply 1121 codes SHOULD provide configuration mechanisms so that sites that 1122 conclude that they would undesirably disclose information can disable 1123 or restrict their use. 1125 3.5. Commands for Debugging Addresses 1127 3.5.1. Overview 1129 SMTP provides commands to verify a user name or obtain the content of 1130 a mailing list. This is done with the VRFY and EXPN commands, which 1131 have character string arguments. Implementations SHOULD support VRFY 1132 and EXPN (however, see Section 3.5.2 and Section 7.3). 1134 For the VRFY command, the string is a user name or a user name and 1135 domain (see below). If a normal (i.e., 250) response is returned, 1136 the response MAY include the full name of the user and MUST include 1137 the mailbox of the user. It MUST be in either of the following 1138 forms: 1140 User Name 1141 local-part@domain 1143 When a name that is the argument to VRFY could identify more than one 1144 mailbox, the server MAY either note the ambiguity or identify the 1145 alternatives. In other words, any of the following are legitimate 1146 responses to VRFY: 1148 553 User ambiguous 1150 or 1152 553- Ambiguous; Possibilities are 1153 553-Joe Smith 1154 553-Harry Smith 1155 553 Melvin Smith 1157 or 1159 553-Ambiguous; Possibilities 1160 553- 1161 553- 1162 553 1164 Under normal circumstances, a client receiving a 553 reply would be 1165 expected to expose the result to the user. Use of exactly the forms 1166 given, and the "user ambiguous" or "ambiguous" keywords, possibly 1167 supplemented by extended reply codes, such as those described in RFC 1168 3463 [34], will facilitate automated translation into other languages 1169 as needed. Of course, a client that was highly automated or that was 1170 operating in another language than English might choose to try to 1171 translate the response to return some other indication to the user 1172 than the literal text of the reply, or to take some automated action 1173 such as consulting a directory service for additional information 1174 before reporting to the user. 1176 For the EXPN command, the string identifies a mailing list, and the 1177 successful (i.e., 250) multiline response MAY include the full name 1178 of the users and MUST give the mailboxes on the mailing list. 1180 In some hosts, the distinction between a mailing list and an alias 1181 for a single mailbox is a bit fuzzy, since a common data structure 1182 may hold both types of entries, and it is possible to have mailing 1183 lists containing only one mailbox. If a request is made to apply 1184 VRFY to a mailing list, a positive response MAY be given if a message 1185 so addressed would be delivered to everyone on the list, otherwise an 1186 error SHOULD be reported (e.g., "550 That is a mailing list, not a 1187 user" or "252 Unable to verify members of mailing list"). If a 1188 request is made to expand a user name, the server MAY return a 1189 positive response consisting of a list containing one name, or an 1190 error MAY be reported (e.g., "550 That is a user name, not a mailing 1191 list"). 1193 In the case of a successful multiline reply (normal for EXPN), 1194 exactly one mailbox is to be specified on each line of the reply. 1195 The case of an ambiguous request is discussed above. 1197 "User name" is a fuzzy term and has been used deliberately. An 1198 implementation of the VRFY or EXPN commands MUST include at least 1199 recognition of local mailboxes as "user names". However, since 1200 current Internet practice often results in a single host handling 1201 mail for multiple domains, hosts, especially hosts that provide this 1202 functionality, SHOULD accept the "local-part@domain" form as a "user 1203 name"; hosts MAY also choose to recognize other strings as "user 1204 names". 1206 The case of expanding a mailbox list requires a multiline reply, such 1207 as: 1209 C: EXPN Example-People 1210 S: 250-Jon Postel 1211 S: 250-Fred Fonebone 1212 S: 250 Sam Q. Smith 1214 or 1216 C: EXPN Executive-Washroom-List 1217 S: 550 Access Denied to You. 1219 The character string arguments of the VRFY and EXPN commands cannot 1220 be further restricted due to the variety of implementations of the 1221 user name and mailbox list concepts. On some systems, it may be 1222 appropriate for the argument of the EXPN command to be a file name 1223 for a file containing a mailing list, but again there are a variety 1224 of file naming conventions in the Internet. Similarly, historical 1225 variations in what is returned by these commands are such that the 1226 response SHOULD be interpreted very carefully, if at all, and SHOULD 1227 generally only be used for diagnostic purposes. 1229 3.5.2. VRFY Normal Response 1231 When normal (2yz or 551) responses are returned from a VRFY or EXPN 1232 request, the reply MUST include the name using a "" construction, where "domain" is a fully-qualified 1234 domain name. In circumstances exceptional enough to justify 1235 violating the intent of this specification, free-form text MAY be 1236 returned. In order to facilitate parsing by both computers and 1237 people, addresses SHOULD appear in pointed brackets. When addresses, 1238 rather than free-form debugging information, are returned, EXPN and 1239 VRFY MUST return only valid domain addresses that are usable in SMTP 1240 RCPT commands. Consequently, if an address implies delivery to a 1241 program or other system, the mailbox name used to reach that target 1242 MUST be given. Paths (explicit source routes) MUST NOT be returned 1243 by VRFY or EXPN. 1245 Server implementations SHOULD support both VRFY and EXPN. For 1246 security reasons, implementations MAY provide local installations a 1247 way to disable either or both of these commands through configuration 1248 options or the equivalent (see Section 7.3). When these commands are 1249 supported, they are not required to work across relays when relaying 1250 is supported. Since they were both optional in RFC 821, but VRFY was 1251 made mandatory in RFC 1123 [5], if EXPN is supported, it MUST be 1252 listed as a service extension in an EHLO response. VRFY MAY be 1253 listed as a convenience but, since support for it is required, SMTP 1254 clients are not required to check for its presence on the extension 1255 list before using it. 1257 3.5.3. Meaning of VRFY or EXPN Success Response 1259 A server MUST NOT return a 250 code in response to a VRFY or EXPN 1260 command unless it has actually verified the address. In particular, 1261 a server MUST NOT return 250 if all it has done is to verify that the 1262 syntax given is valid. In that case, 502 (Command not implemented) 1263 or 500 (Syntax error, command unrecognized) SHOULD be returned. As 1264 stated elsewhere, implementation (in the sense of actually validating 1265 addresses and returning information) of VRFY and EXPN are strongly 1266 recommended. Hence, implementations that return 500 or 502 for VRFY 1267 are not in full compliance with this specification. 1269 There may be circumstances where an address appears to be valid but 1270 cannot reasonably be verified in real time, particularly when a 1271 server is acting as a mail exchanger for another server or domain. 1272 "Apparent validity", in this case, would normally involve at least 1273 syntax checking and might involve verification that any domains 1274 specified were ones to which the host expected to be able to relay 1275 mail. In these situations, reply code 252 SHOULD be returned. These 1276 cases parallel the discussion of RCPT verification in Section 2.1. 1278 Similarly, the discussion in Section 3.4 applies to the use of reply 1279 codes 251 and 551 with VRFY (and EXPN) to indicate addresses that are 1280 recognized but that would be forwarded or rejected were mail received 1281 for them. Implementations generally SHOULD be more aggressive about 1282 address verification in the case of VRFY than in the case of RCPT, 1283 even if it takes a little longer to do so. 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 [4], RFC 974 [15]) 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. [[CREF9: [5321bis] Jck 20091023: "of names..." 1318 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 [41] and DKIM [43] [44], 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 6409 [42]). In any event, because these arrangements are 1362 private and fall outside the scope of this specification, they are 1363 not described here. 1365 It is important to note that MX records can point to SMTP servers 1366 that act as gateways into other environments, not just SMTP relays 1367 and final delivery systems; see Sections 3.7 and 5. 1369 If an SMTP server has accepted the task of relaying the mail and 1370 later finds that the destination is incorrect or that the mail cannot 1371 be delivered for some other reason, then it MUST construct an 1372 "undeliverable mail" notification message and send it to the 1373 originator of the undeliverable mail (as indicated by the reverse- 1374 path). Formats specified for non-delivery reports by other standards 1375 (see, for example, RFC 3461 [33] and RFC 3464 [35]) SHOULD be used if 1376 possible. 1378 This notification message must be from the SMTP server at the relay 1379 host or the host that first determines that delivery cannot be 1380 accomplished. Of course, SMTP servers MUST NOT send notification 1381 messages about problems transporting notification messages. One way 1382 to prevent loops in error reporting is to specify a null reverse-path 1383 in the MAIL command of a notification message. When such a message 1384 is transmitted, the reverse-path MUST be set to null (see 1385 Section 4.5.5 for additional discussion). A MAIL command with a null 1386 reverse-path appears as follows: 1388 MAIL FROM:<> 1390 As discussed in Section 6.4, a relay SMTP has no need to inspect or 1391 act upon the header section or body of the message data and MUST NOT 1392 do so except to add its own "Received:" header field (Section 4.4) 1393 and, optionally, to attempt to detect looping in the mail system (see 1394 Section 6.3). Of course, this prohibition also applies to any 1395 modifications of these header fields or text (see also Section 7.9). 1397 3.7. Mail Gatewaying 1399 While the relay function discussed above operates within the Internet 1400 SMTP transport service environment, MX records or various forms of 1401 explicit routing may require that an intermediate SMTP server perform 1402 a translation function between one transport service and another. As 1403 discussed in Section 2.3.10, when such a system is at the boundary 1404 between two transport service environments, we refer to it as a 1405 "gateway" or "gateway SMTP". 1407 Gatewaying mail between different mail environments, such as 1408 different mail formats and protocols, is complex and does not easily 1409 yield to standardization. However, some general requirements may be 1410 given for a gateway between the Internet and another mail 1411 environment. 1413 3.7.1. Header Fields in Gatewaying 1415 Header fields MAY be rewritten when necessary as messages are 1416 gatewayed across mail environment boundaries. This may involve 1417 inspecting the message body or interpreting the local-part of the 1418 destination address in spite of the prohibitions in Section 6.4. 1420 Other mail systems gatewayed to the Internet often use a subset of 1421 the RFC 822 header section or provide similar functionality with a 1422 different syntax, but some of these mail systems do not have an 1423 equivalent to the SMTP envelope. Therefore, when a message leaves 1424 the Internet environment, it may be necessary to fold the SMTP 1425 envelope information into the message header section. A possible 1426 solution would be to create new header fields to carry the envelope 1427 information (e.g., "X-SMTP-MAIL:" and "X-SMTP-RCPT:"); however, this 1428 would require changes in mail programs in foreign environments and 1429 might risk disclosure of private information (see Section 7.2). 1431 3.7.2. Received Lines in Gatewaying 1433 When forwarding a message into or out of the Internet environment, a 1434 gateway MUST prepend a Received: line, but it MUST NOT alter in any 1435 way a Received: line that is already in the header section. 1437 "Received:" header fields of messages originating from other 1438 environments may not conform exactly to this specification. However, 1439 the most important use of Received: lines is for debugging mail 1440 faults, and this debugging can be severely hampered by well-meaning 1441 gateways that try to "fix" a Received: line. As another consequence 1442 of trace header fields arising in non-SMTP environments, receiving 1443 systems MUST NOT reject mail based on the format of a trace header 1444 field and SHOULD be extremely robust in the light of unexpected 1445 information or formats in those header fields. 1447 The gateway SHOULD indicate the environment and protocol in the "via" 1448 clauses of Received header field(s) that it supplies. 1450 3.7.3. Addresses in Gatewaying 1452 From the Internet side, the gateway SHOULD accept all valid address 1453 formats in SMTP commands and in the RFC 822 header section, and all 1454 valid RFC 822 messages. Addresses and header fields generated by 1455 gateways MUST conform to applicable standards (including this one and 1456 RFC 5322 [11]). Gateways are, of course, subject to the same rules 1457 for handling source routes as those described for other SMTP systems 1458 in Section 3.3. 1460 3.7.4. Other Header Fields in Gatewaying 1462 The gateway MUST ensure that all header fields of a message that it 1463 forwards into the Internet mail environment meet the requirements for 1464 Internet mail. In particular, all addresses in "From:", "To:", 1465 "Cc:", etc., header fields MUST be transformed (if necessary) to 1466 satisfy the standard header syntax of RFC 5322 [11], MUST reference 1467 only fully-qualified domain names, and MUST be effective and useful 1468 for sending replies. The translation algorithm used to convert mail 1469 from the Internet protocols to another environment's protocol SHOULD 1470 ensure that error messages from the foreign mail environment are 1471 delivered to the reverse-path from the SMTP envelope, not to an 1472 address in the "From:", "Sender:", or similar header fields of the 1473 message. 1475 3.7.5. Envelopes in Gatewaying 1477 Similarly, when forwarding a message from another environment into 1478 the Internet, the gateway SHOULD set the envelope return path in 1479 accordance with an error message return address, if supplied by the 1480 foreign environment. If the foreign environment has no equivalent 1481 concept, the gateway must select and use a best approximation, with 1482 the message originator's address as the default of last resort. 1484 3.8. Terminating Sessions and Connections 1486 An SMTP connection is terminated when the client sends a QUIT 1487 command. The server responds with a positive reply code, after which 1488 it closes the connection. 1490 An SMTP server MUST NOT intentionally close the connection under 1491 normal operational circumstances (see Section 7.8) except: 1493 o After receiving a QUIT command and responding with a 221 reply. 1495 o After detecting the need to shut down the SMTP service and 1496 returning a 421 reply code. This reply code can be issued after 1497 the server receives any command or, if necessary, asynchronously 1498 from command receipt (on the assumption that the client will 1499 receive it after the next command is issued). 1501 o After a timeout, as specified in Section 4.5.3.2, occurs waiting 1502 for the client to send a command or data. 1504 In particular, a server that closes connections in response to 1505 commands that are not understood is in violation of this 1506 specification. Servers are expected to be tolerant of unknown 1507 commands, issuing a 500 reply and awaiting further instructions from 1508 the client. 1510 An SMTP server that is forcibly shut down via external means SHOULD 1511 attempt to send a line containing a 421 reply code to the SMTP client 1512 before exiting. The SMTP client will normally read the 421 reply 1513 code after sending its next command. 1515 SMTP clients that experience a connection close, reset, or other 1516 communications failure due to circumstances not under their control 1517 (in violation of the intent of this specification but sometimes 1518 unavoidable) SHOULD, to maintain the robustness of the mail system, 1519 treat the mail transaction as if a 421 response had been received and 1520 act accordingly. 1522 There are circumstances, contrary to the intent of this 1523 specification, in which an SMTP server may receive an indication that 1524 the underlying TCP connection has been closed or reset. To preserve 1525 the robustness of the mail system, SMTP servers SHOULD be prepared 1526 for this condition and SHOULD treat it as if a QUIT had been received 1527 before the connection disappeared. 1529 3.9. Mailing Lists and Aliases 1531 [[CREF10: [5321bis] If "alias and list models" are explained 1532 elsewhere, cross reference". Also note that this section appears to 1533 prohibit an exploder from adding List-* headers. That needs to be 1534 finessed.]] 1535 An SMTP-capable host SHOULD support both the alias and the list 1536 models of address expansion for multiple delivery. When a message is 1537 delivered or forwarded to each address of an expanded list form, the 1538 return address in the envelope ("MAIL FROM:") MUST be changed to be 1539 the address of a person or other entity who administers the list. 1540 However, in this case, the message header section (RFC 5322 [11]) 1541 MUST be left unchanged; in particular, the "From" field of the header 1542 section is unaffected. 1544 An important mail facility is a mechanism for multi-destination 1545 delivery of a single message, by transforming (or "expanding" or 1546 "exploding") a pseudo-mailbox address into a list of destination 1547 mailbox addresses. When a message is sent to such a pseudo-mailbox 1548 (sometimes called an "exploder"), copies are forwarded or 1549 redistributed to each mailbox in the expanded list. Servers SHOULD 1550 simply utilize the addresses on the list; application of heuristics 1551 or other matching rules to eliminate some addresses, such as that of 1552 the originator, is strongly discouraged. We classify such a pseudo- 1553 mailbox as an "alias" or a "list", depending upon the expansion 1554 rules. 1556 3.9.1. Alias 1558 To expand an alias, the recipient mailer simply replaces the pseudo- 1559 mailbox address in the envelope with each of the expanded addresses 1560 in turn; the rest of the envelope and the message body are left 1561 unchanged. The message is then delivered or forwarded to each 1562 expanded address. 1564 3.9.2. List 1566 A mailing list may be said to operate by "redistribution" rather than 1567 by "forwarding". To expand a list, the recipient mailer replaces the 1568 pseudo-mailbox address in the envelope with each of the expanded 1569 addresses in turn. The return (backward-pointing) address in the 1570 envelope is changed so that all error messages generated by the final 1571 deliveries will be returned to a list administrator, not to the 1572 message originator, who generally has no control over the contents of 1573 the list and will typically find error messages annoying. Note that 1574 the key difference between handling aliases (Section 3.9.1) and 1575 forwarding (this subsection) is the change to the backward-pointing 1576 address in this case. When a list constrains its processing to the 1577 very limited set of modifications and actions described here, it is 1578 attempting to emulate an MTA; such lists can be treated as a 1579 continuation in email transit. 1581 There exist mailing lists that perform additional, sometimes 1582 extensive, modifications to a message and its envelope. Such mailing 1583 lists need to be viewed as full MUAs, which accept a delivery and 1584 post a new message. 1586 4. The SMTP Specifications 1588 4.1. SMTP Commands 1590 4.1.1. Command Semantics and Syntax 1592 The SMTP commands define the mail transfer or the mail system 1593 function requested by the user. SMTP commands are character strings 1594 terminated by . The commands themselves are alphabetic 1595 characters terminated by if parameters follow and 1596 otherwise. (In the interest of improved interoperability, SMTP 1597 receivers SHOULD tolerate trailing white space before the terminating 1598 .) The syntax of the local part of a mailbox MUST conform to 1599 receiver site conventions and the syntax specified in Section 4.1.2. 1600 The SMTP commands are discussed below. The SMTP replies are 1601 discussed in Section 4.2. 1603 A mail transaction involves several data objects that are 1604 communicated as arguments to different commands. The reverse-path is 1605 the argument of the MAIL command, the forward-path is the argument of 1606 the RCPT command, and the mail data is the argument of the DATA 1607 command. These arguments or data objects must be transmitted and 1608 held, pending the confirmation communicated by the end of mail data 1609 indication that finalizes the transaction. The model for this is 1610 that distinct buffers are provided to hold the types of data objects; 1611 that is, there is a reverse-path buffer, a forward-path buffer, and a 1612 mail data buffer. Specific commands cause information to be appended 1613 to a specific buffer, or cause one or more buffers to be cleared. 1615 Several commands (RSET, DATA, QUIT) are specified as not permitting 1616 parameters. In the absence of specific extensions offered by the 1617 server and accepted by the client, clients MUST NOT send such 1618 parameters and servers SHOULD reject commands containing them as 1619 having invalid syntax. 1621 4.1.1.1. Extended HELLO (EHLO) or HELLO (HELO) 1623 These commands are used to identify the SMTP client to the SMTP 1624 server. The argument clause contains the fully-qualified domain name 1625 of the SMTP client, if one is available. In situations in which the 1626 SMTP client system does not have a meaningful domain name (e.g., when 1627 its address is dynamically allocated and no reverse mapping record is 1628 available), the client SHOULD send an address literal (see 1629 Section 4.1.3). 1631 RFC 2821, and some earlier informal practices, encouraged following 1632 the literal by information that would help to identify the client 1633 system. That convention was not widely supported, and many SMTP 1634 servers considered it an error. In the interest of interoperability, 1635 it is probably wise for servers to be prepared for this string to 1636 occur, but SMTP clients SHOULD NOT send it. 1638 The SMTP server identifies itself to the SMTP client in the 1639 connection greeting reply and in the response to this command. 1641 A client SMTP SHOULD start an SMTP session by issuing the EHLO 1642 command. If the SMTP server supports the SMTP service extensions, it 1643 will give a successful response, a failure response, or an error 1644 response. If the SMTP server, in violation of this specification, 1645 does not support any SMTP service extensions, it will generate an 1646 error response. Older client SMTP systems MAY, as discussed above, 1647 use HELO (as specified in RFC 821) instead of EHLO, and servers MUST 1648 support the HELO command and reply properly to it. In any event, a 1649 client MUST issue HELO or EHLO before starting a mail transaction. 1651 These commands, and a "250 OK" reply to one of them, confirm that 1652 both the SMTP client and the SMTP server are in the initial state, 1653 that is, there is no transaction in progress and all state tables and 1654 buffers are cleared. 1656 Syntax: 1658 ehlo = "EHLO" SP ( Domain / address-literal ) CRLF 1659 helo = "HELO" SP Domain CRLF 1661 Normally, the response to EHLO will be a multiline reply. Each line 1662 of the response contains a keyword and, optionally, one or more 1663 parameters. Following the normal syntax for multiline replies, these 1664 keywords follow the code (250) and a hyphen for all but the last 1665 line, and the code and a space for the last line. The syntax for a 1666 positive response, using the ABNF notation and terminal symbols of 1667 RFC 5234 [10], is: 1669 ehlo-ok-rsp = ( "250" SP Domain [ SP ehlo-greet ] CRLF ) 1670 / ( "250-" Domain [ SP ehlo-greet ] CRLF 1671 *( "250-" ehlo-line CRLF ) 1672 "250" SP ehlo-line CRLF ) 1674 ehlo-greet = 1*(%d0-9 / %d11-12 / %d14-127) 1675 ; string of any characters other than CR or LF 1677 ehlo-line = ehlo-keyword *( SP ehlo-param ) 1679 ehlo-keyword = (ALPHA / DIGIT) *(ALPHA / DIGIT / "-") 1680 ; additional syntax of ehlo-params depends on 1681 ; ehlo-keyword 1683 ehlo-param = 1*(%d33-126) 1684 ; any CHAR excluding and all 1685 ; control characters (US-ASCII 0-31 and 127 1686 ; inclusive) 1688 Although EHLO keywords may be specified in upper, lower, or mixed 1689 case, they MUST always be recognized and processed in a case- 1690 insensitive manner. This is simply an extension of practices 1691 specified in RFC 821 and Section 2.4. 1693 The EHLO response MUST contain keywords (and associated parameters if 1694 required) for all commands not listed as "required" in Section 4.5.1 1695 excepting only private-use commands as described in Section 4.1.5. 1696 Private-use commands MAY be listed. 1698 4.1.1.2. MAIL (MAIL) 1700 This command is used to initiate a mail transaction in which the mail 1701 data is delivered to an SMTP server that may, in turn, deliver it to 1702 one or more mailboxes or pass it on to another system (possibly using 1703 SMTP). The argument clause contains a reverse-path and may contain 1704 optional parameters. In general, the MAIL command may be sent only 1705 when no mail transaction is in progress, see Section 4.1.4. 1707 The reverse-path consists of the sender mailbox. Historically, that 1708 mailbox might optionally have been preceded by a list of hosts, but 1709 that behavior is now deprecated (see Appendix C). In some types of 1710 reporting messages for which a reply is likely to cause a mail loop 1711 (for example, mail delivery and non-delivery notifications), the 1712 reverse-path may be null (see Section 3.6). 1714 This command clears the reverse-path buffer, the forward-path buffer, 1715 and the mail data buffer, and it inserts the reverse-path information 1716 from its argument clause into the reverse-path buffer. 1718 If service extensions were negotiated, the MAIL command may also 1719 carry parameters associated with a particular service extension. 1721 Syntax: 1723 mail = "MAIL FROM:" Reverse-path 1724 [SP Mail-parameters] CRLF 1726 4.1.1.3. RECIPIENT (RCPT) 1728 This command is used to identify an individual recipient of the mail 1729 data; multiple recipients are specified by multiple uses of this 1730 command. The argument clause contains a forward-path and may contain 1731 optional parameters. 1733 The forward-path normally consists of the required destination 1734 mailbox. Sending systems SHOULD NOT generate the optional list of 1735 hosts known as a source route. Receiving systems MUST recognize 1736 source route syntax but SHOULD strip off the source route 1737 specification and utilize the domain name associated with the mailbox 1738 as if the source route had not been provided. 1740 Similarly, relay hosts SHOULD strip or ignore source routes, and 1741 names MUST NOT be copied into the reverse-path. When mail reaches 1742 its ultimate destination (the forward-path contains only a 1743 destination mailbox), the SMTP server inserts it into the destination 1744 mailbox in accordance with its host mail conventions. 1746 This command appends its forward-path argument to the forward-path 1747 buffer; it does not change the reverse-path buffer nor the mail data 1748 buffer. 1750 For example, mail received at relay host xyz.com with envelope 1751 commands 1753 MAIL FROM: 1754 RCPT TO:<@hosta.int,@jkl.org:userc@d.bar.org> 1756 will normally be sent directly on to host d.bar.org with envelope 1757 commands 1759 MAIL FROM: 1760 RCPT TO: 1762 As provided in Appendix C, xyz.com MAY also choose to relay the 1763 message to hosta.int, using the envelope commands 1765 MAIL FROM: 1766 RCPT TO:<@hosta.int,@jkl.org:userc@d.bar.org> 1768 or to jkl.org, using the envelope commands 1770 MAIL FROM: 1771 RCPT TO:<@jkl.org:userc@d.bar.org> 1773 Attempting to use relaying this way is now strongly discouraged. 1774 Since hosts are not required to relay mail at all, xyz.com MAY also 1775 reject the message entirely when the RCPT command is received, using 1776 a 550 code (since this is a "policy reason"). 1778 If service extensions were negotiated, the RCPT command may also 1779 carry parameters associated with a particular service extension 1780 offered by the server. The client MUST NOT transmit parameters other 1781 than those associated with a service extension offered by the server 1782 in its EHLO response. 1784 Syntax: 1786 rcpt = "RCPT TO:" ( "" / "" / 1787 Forward-path ) [SP Rcpt-parameters] CRLF 1789 Note that, in a departure from the usual rules for 1790 local-parts, the "Postmaster" string shown above is 1791 treated as case-insensitive. 1793 4.1.1.4. DATA (DATA) 1795 The receiver normally sends a 354 response to DATA, and then treats 1796 the lines (strings ending in sequences, as described in 1797 Section 2.3.7) following the command as mail data from the sender. 1798 This command causes the mail data to be appended to the mail data 1799 buffer. The mail data may contain any of the 128 ASCII character 1800 codes, although experience has indicated that use of control 1801 characters other than SP, HT, CR, and LF may cause problems and 1802 SHOULD be avoided when possible. 1804 The mail data are terminated by a line containing only a period, that 1805 is, the character sequence ".", where the first is 1806 actually the terminator of the previous line (see Section 4.5.2). 1807 This is the end of mail data indication. The first of this 1808 terminating sequence is also the that ends the final line of 1809 the data (message text) or, if there was no mail data, ends the DATA 1810 command itself (the "no mail data" case does not conform to this 1811 specification since it would require that neither the trace header 1812 fields required by this specification nor the message header section 1813 required by RFC 5322 [11] be transmitted). An extra MUST NOT 1814 be added, as that would cause an empty line to be added to the 1815 message. The only exception to this rule would arise if the message 1816 body were passed to the originating SMTP-sender with a final "line" 1817 that did not end in ; in that case, the originating SMTP system 1818 MUST either reject the message as invalid or add in order to 1819 have the receiving SMTP server recognize the "end of data" condition. 1821 The custom of accepting lines ending only in , as a concession to 1822 non-conforming behavior on the part of some UNIX systems, has proven 1823 to cause more interoperability problems than it solves, and SMTP 1824 server systems MUST NOT do this, even in the name of improved 1825 robustness. In particular, the sequence "." (bare line 1826 feeds, without carriage returns) MUST NOT be treated as equivalent to 1827 . as the end of mail data indication. 1829 Receipt of the end of mail data indication requires the server to 1830 process the stored mail transaction information. This processing 1831 consumes the information in the reverse-path buffer, the forward-path 1832 buffer, and the mail data buffer, and on the completion of this 1833 command these buffers are cleared. If the processing is successful, 1834 the receiver MUST send an OK reply. If the processing fails, the 1835 receiver MUST send a failure reply. The SMTP model does not allow 1836 for partial failures at this point: either the message is accepted by 1837 the server for delivery and a positive response is returned or it is 1838 not accepted and a failure reply is returned. In sending a positive 1839 "250 OK" completion reply to the end of data indication, the receiver 1840 takes full responsibility for the message (see Section 6.1). Errors 1841 that are diagnosed subsequently MUST be reported in a mail message, 1842 as discussed in Section 4.4. 1844 When the SMTP server accepts a message either for relaying or for 1845 final delivery, it inserts a trace record (also referred to 1846 interchangeably as a "time stamp line" or "Received" line) at the top 1847 of the mail data. This trace record indicates the identity of the 1848 host that sent the message, the identity of the host that received 1849 the message (and is inserting this time stamp), and the date and time 1850 the message was received. Relayed messages will have multiple time 1851 stamp lines. Details for formation of these lines, including their 1852 syntax, is specified in Section 4.4. 1854 Additional discussion about the operation of the DATA command appears 1855 in Section 3.3. 1857 Syntax: 1859 data = "DATA" CRLF 1861 4.1.1.5. RESET (RSET) 1863 This command specifies that the current mail transaction will be 1864 aborted. Any stored sender, recipients, and mail data MUST be 1865 discarded, and all buffers and state tables cleared. The receiver 1866 MUST send a "250 OK" reply to a RSET command with no arguments. A 1867 reset command may be issued by the client at any time. It is 1868 effectively equivalent to a NOOP (i.e., it has no effect) if issued 1869 immediately after EHLO, before EHLO is issued in the session, after 1870 an end of data indicator has been sent and acknowledged, or 1871 immediately before a QUIT. An SMTP server MUST NOT close the 1872 connection as the result of receiving a RSET; that action is reserved 1873 for QUIT (see Section 4.1.1.10). 1875 Since EHLO implies some additional processing and response by the 1876 server, RSET will normally be more efficient than reissuing that 1877 command, even though the formal semantics are the same. 1879 Syntax: 1881 rset = "RSET" CRLF 1883 4.1.1.6. VERIFY (VRFY) 1885 This command asks the receiver to confirm that the argument 1886 identifies a user or mailbox. If it is a user name, information is 1887 returned as specified in Section 3.5. 1889 This command has no effect on the reverse-path buffer, the forward- 1890 path buffer, or the mail data buffer. 1892 Syntax: 1894 vrfy = "VRFY" SP String CRLF 1896 4.1.1.7. EXPAND (EXPN) 1898 This command asks the receiver to confirm that the argument 1899 identifies a mailing list, and if so, to return the membership of 1900 that list. If the command is successful, a reply is returned 1901 containing information as described in Section 3.5. This reply will 1902 have multiple lines except in the trivial case of a one-member list. 1904 This command has no effect on the reverse-path buffer, the forward- 1905 path buffer, or the mail data buffer, and it may be issued at any 1906 time. 1908 Syntax: 1910 expn = "EXPN" SP String CRLF 1912 4.1.1.8. HELP (HELP) 1914 This command causes the server to send helpful information to the 1915 client. The command MAY take an argument (e.g., any command name) 1916 and return more specific information as a response. 1918 This command has no effect on the reverse-path buffer, the forward- 1919 path buffer, or the mail data buffer, and it may be issued at any 1920 time. 1922 SMTP servers SHOULD support HELP without arguments and MAY support it 1923 with arguments. 1925 Syntax: 1927 help = "HELP" [ SP String ] CRLF 1929 4.1.1.9. NOOP (NOOP) 1931 This command does not affect any parameters or previously entered 1932 commands. It specifies no action other than that the receiver send a 1933 "250 OK" reply. 1935 This command has no effect on the reverse-path buffer, the forward- 1936 path buffer, or the mail data buffer, and it may be issued at any 1937 time. If a parameter string is specified, servers SHOULD ignore it. 1939 Syntax: 1941 noop = "NOOP" [ SP String ] CRLF 1943 4.1.1.10. QUIT (QUIT) 1945 This command specifies that the receiver MUST send a "221 OK" reply, 1946 and then close the transmission channel. 1948 The receiver MUST NOT intentionally close the transmission channel 1949 until it receives and replies to a QUIT command (even if there was an 1950 error). The sender MUST NOT intentionally close the transmission 1951 channel until it sends a QUIT command, and it SHOULD wait until it 1952 receives the reply (even if there was an error response to a previous 1953 command). If the connection is closed prematurely due to violations 1954 of the above or system or network failure, the server MUST cancel any 1955 pending transaction, but not undo any previously completed 1956 transaction, and generally MUST act as if the command or transaction 1957 in progress had received a temporary error (i.e., a 4yz response). 1959 The QUIT command may be issued at any time. Any current uncompleted 1960 mail transaction will be aborted. 1962 Syntax: 1964 quit = "QUIT" CRLF 1966 4.1.1.11. Mail-Parameter and Rcpt-Parameter Error Responses 1968 If the server SMTP does not recognize or cannot implement one or more 1969 of the parameters associated with a particular MAIL FROM or RCPT TO 1970 command, it will return code 555. 1972 If, for some reason, the server is temporarily unable to accommodate 1973 one or more of the parameters associated with a MAIL FROM or RCPT TO 1974 command, and if the definition of the specific parameter does not 1975 mandate the use of another code, it should return code 455. 1977 Errors specific to particular parameters and their values will be 1978 specified in the parameter's defining RFC. 1980 4.1.2. Command Argument Syntax 1982 The syntax of the argument clauses of the above commands (using the 1983 syntax specified in RFC 5234 [10] where applicable) is given below. 1984 Some of the productions given below are used only in conjunction with 1985 source routes as described in Appendix C. Some terminals not defined 1986 in this document, but are defined elsewhere, specifically: 1988 In the "core" syntax in Appendix B of RFC 5234 [10]: ALPHA , CRLF 1989 , DIGIT , HEXDIG , and SP 1990 In the message format syntax in RFC 5322 [11]: atext , CFWS , and 1991 FWS . 1993 Reverse-path = Path / "<>" 1995 Forward-path = Path 1997 Path = "<" [ A-d-l ":" ] Mailbox ">" 1999 A-d-l = At-domain *( "," At-domain ) 2000 ; Note that this form, the so-called "source 2001 ; route", MUST BE accepted, SHOULD NOT be 2002 ; generated, and SHOULD be ignored. 2004 At-domain = "@" Domain 2006 Mail-parameters = esmtp-param *(SP esmtp-param) 2008 Rcpt-parameters = esmtp-param *(SP esmtp-param) 2010 esmtp-param = esmtp-keyword ["=" esmtp-value] 2012 esmtp-keyword = (ALPHA / DIGIT) *(ALPHA / DIGIT / "-") 2014 esmtp-value = 1*(%d33-60 / %d62-126) 2015 ; any CHAR excluding "=", SP, and control 2016 ; characters. If this string is an email address, 2017 ; i.e., a Mailbox, then the "xtext" syntax [33] 2018 ; SHOULD be used. 2020 Keyword = Ldh-str 2022 Argument = Atom 2024 Domain = sub-domain *("." sub-domain) 2026 sub-domain = Let-dig [Ldh-str] 2028 Let-dig = ALPHA / DIGIT 2030 Ldh-str = *( ALPHA / DIGIT / "-" ) Let-dig 2032 address-literal = "[" ( IPv4-address-literal / 2033 IPv6-address-literal / 2034 General-address-literal ) "]" 2035 ; See Section 4.1.3 2037 Mailbox = Local-part "@" ( Domain / address-literal ) 2038 Local-part = Dot-string / Quoted-string 2039 ; MAY be case-sensitive 2041 Dot-string = Atom *("." Atom) 2043 Atom = 1*atext 2045 Quoted-string = DQUOTE 1*QcontentSMTP DQUOTE 2047 QcontentSMTP = qtextSMTP / quoted-pairSMTP 2049 quoted-pairSMTP = %d92 %d32-126 2050 ; i.e., backslash followed by any ASCII 2051 ; graphic (including itself) or SPace 2053 qtextSMTP = %d32-33 / %d35-91 / %d93-126 2054 ; i.e., within a quoted string, any 2055 ; ASCII graphic or space is permitted 2056 ; without backslash-quoting except 2057 ; double-quote and the backslash itself. 2059 String = Atom / Quoted-string 2061 While the above definition for Local-part is relatively permissive, 2062 for maximum interoperability, a host that expects to receive mail 2063 SHOULD avoid defining mailboxes where the Local-part requires (or 2064 uses) the Quoted-string form or where the Local-part is case- 2065 sensitive. For any purposes that require generating or comparing 2066 Local-parts (e.g., to specific mailbox names), all quoted forms MUST 2067 be treated as equivalent, and the sending system SHOULD transmit the 2068 form that uses the minimum quoting possible. 2070 Systems MUST NOT define mailboxes in such a way as to require the use 2071 in SMTP of non-ASCII characters (octets with the high order bit set 2072 to one) or ASCII "control characters" (decimal value 0-31 and 127). 2073 These characters MUST NOT be used in MAIL or RCPT commands or other 2074 commands that require mailbox names. 2076 Note that the backslash, "\", is a quote character, which is used to 2077 indicate that the next character is to be used literally (instead of 2078 its normal interpretation). For example, "Joe\,Smith" indicates a 2079 single nine-character user name string with the comma being the 2080 fourth character of that string. 2082 To promote interoperability and consistent with long-standing 2083 guidance about conservative use of the DNS in naming and applications 2084 (e.g., see Section 2.3.1 of the base DNS document, RFC 1035 [4]), 2085 characters outside the set of alphabetic characters, digits, and 2086 hyphen MUST NOT appear in domain name labels for SMTP clients or 2087 servers. In particular, the underscore character is not permitted. 2088 SMTP servers that receive a command in which invalid character codes 2089 have been employed, and for which there are no other reasons for 2090 rejection, MUST reject that command with a 501 response (this rule, 2091 like others, could be overridden by appropriate SMTP extensions). 2093 4.1.3. Address Literals 2095 Sometimes a host is not known to the domain name system and 2096 communication (and, in particular, communication to report and repair 2097 the error) is blocked. To bypass this barrier, a special literal 2098 form of the address is allowed as an alternative to a domain name. 2099 For IPv4 addresses, this form uses four small decimal integers 2100 separated by dots and enclosed by brackets such as [123.255.37.2], 2101 which indicates an (IPv4) Internet Address in sequence-of-octets 2102 form. For IPv6 and other forms of addressing that might eventually 2103 be standardized, the form consists of a standardized "tag" that 2104 identifies the address syntax, a colon, and the address itself, in a 2105 format specified as part of the relevant standards (i.e., RFC 4291 2106 [9] for IPv6). 2107 [[CREF11: [5321bis] Proposed erratum 4315 (2015-03-27) suggests yet 2108 another modification to the IPv6 address literal syntax, based on 2109 part on RFC 5952. We should consider whether those, or other, 2110 modifications are appropriate and/or whether, given both the issues 2111 of spam/malware and servers supporting multiple domains, it it time 2112 to deprecate mailboxes containing address literals entirely (EHLO 2113 fields may be a different issue). If we are going to allow IPv6 2114 address literals, it may be time to incorporate something by 2115 reference rather than including specific syntax here (RFC 5952 is 14 2116 pages long and does not contain any ABNF).]] 2118 Specifically: 2120 IPv4-address-literal = Snum 3("." Snum) 2122 IPv6-address-literal = "IPv6:" IPv6-addr 2124 General-address-literal = Standardized-tag ":" 1*dcontent 2126 Standardized-tag = Ldh-str 2127 ; Standardized-tag MUST be specified in a 2128 ; Standards-Track RFC and registered with IANA 2130 dcontent = %d33-90 / ; Printable US-ASCII 2131 %d94-126 ; excl. "[", "\", "]" 2133 Snum = 1*3DIGIT 2134 ; representing a decimal integer 2135 ; value in the range 0 through 255 2137 IPv6-addr = 6( h16 ":" ) ls32 2138 / "::" 5( h16 ":" ) ls32 2139 / [ h16 ] "::" 4( h16 ":" ) ls32 2140 / [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32 2141 / [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32 2142 / [ *3( h16 ":" ) h16 ] "::" h16 ":" ls32 2143 / [ *4( h16 ":" ) h16 ] "::" ls32 2144 / [ *5( h16 ":" ) h16 ] "::" h16 2145 / [ *6( h16 ":" ) h16 ] "::" 2146 ; This definition is consistent with the one for 2147 ; URIs [40]. 2149 ls32 = ( h16 ":" h16 ) / IPv4address 2150 ; least-significant 32 bits of address 2152 h16 = 1*4HEXDIG 2153 ; 16 bits of address represented in hexadecimal 2154 [[CREF12: [5321bis](2821ter) 2821bis Last Call 2155 comment]] 2157 4.1.4. Order of Commands 2159 There are restrictions on the order in which these commands may be 2160 used. 2162 A session that will contain mail transactions MUST first be 2163 initialized by the use of the EHLO command. An SMTP server SHOULD 2164 accept commands for non-mail transactions (e.g., VRFY, EXPN, or NOOP) 2165 without this initialization. 2167 An EHLO command MAY be issued by a client later in the session. If 2168 it is issued after the session begins and the EHLO command is 2169 acceptable to the SMTP server, the SMTP server MUST clear all buffers 2170 and reset the state exactly as if a RSET command had been issued 2171 (specifically, it terminates any mail transaction that was in 2172 progress, see Section 3.3). In other words, the sequence of RSET 2173 followed immediately by EHLO is redundant, but not harmful other than 2174 in the performance cost of executing unnecessary commands. However 2175 the response to an additional EHLO command MAY be different from that 2176 from prior ones; the client MUST rely only on the responses from the 2177 most recent EHLO command. 2179 If the EHLO command is not acceptable to the SMTP server, 501, 500, 2180 502, or 550 failure replies MUST be returned as appropriate. The 2181 SMTP server MUST stay in the same state after transmitting these 2182 replies that it was in before the EHLO was received. 2184 The SMTP client MUST, if possible, ensure that the domain parameter 2185 to the EHLO command is a primary host name as specified for this 2186 command in Section 2.3.5. If this is not possible (e.g., when the 2187 client's address is dynamically assigned and the client does not have 2188 an obvious name), an address literal SHOULD be substituted for the 2189 domain name. 2191 An SMTP server MAY verify that the domain name argument in the EHLO 2192 command actually corresponds to the IP address of the client. 2193 [[CREF13: [5321bis] [[Note in draft -- proposed change to "An SMTP 2194 server MAY verify that the domain name argument in the EHLO command 2195 has an address record matching the IP address of the client." --David 2196 MacQuigg, david_macquigg@yahoo.com, Friday, 20090130 0637 -0700]]]] 2197 However, if the verification fails, the server MUST NOT refuse to 2198 accept a message on that basis. Information captured in the 2199 verification attempt is for logging and tracing purposes. Note that 2200 this prohibition applies to the matching of the parameter to its IP 2201 address only; see Section 7.9 for a more extensive discussion of 2202 rejecting incoming connections or mail messages. 2204 The NOOP, HELP, EXPN, VRFY, and RSET commands can be used at any time 2205 during a session, or without previously initializing a session. SMTP 2206 servers SHOULD process these normally (that is, not return a 503 2207 code) even if no EHLO command has yet been received; clients SHOULD 2208 open a session with EHLO before sending these commands. 2210 If these rules are followed, the example in RFC 821 that shows "550 2211 access denied to you" in response to an EXPN command is incorrect 2212 unless an EHLO command precedes the EXPN or the denial of access is 2213 based on the client's IP address or other authentication or 2214 authorization-determining mechanisms. 2216 The MAIL command begins a mail transaction. Once started, a mail 2217 transaction consists of a transaction beginning command, one or more 2218 RCPT commands, and a DATA command, in that order. A mail transaction 2219 may be aborted by the RSET, a new EHLO, or the QUIT command. There 2220 may be zero or more transactions in a session. MAIL MUST NOT be sent 2221 if a mail transaction is already open, i.e., it should be sent only 2222 if no mail transaction had been started in the session, or if the 2223 previous one successfully concluded with a successful DATA command, 2224 or if the previous one was aborted, e.g., with a RSET or new EHLO. 2225 [[CREF14: [5321bis] 2821ter note: see comment about changing this 2226 convoluted discussion to talk about 'mail transaction' above. 2227 --Jck]] 2228 If the transaction beginning command argument is not acceptable, a 2229 501 failure reply MUST be returned and the SMTP server MUST stay in 2230 the same state. If the commands in a transaction are out of order to 2231 the degree that they cannot be processed by the server, a 503 failure 2232 reply MUST be returned and the SMTP server MUST stay in the same 2233 state. 2235 The last command in a session MUST be the QUIT command. The QUIT 2236 command SHOULD be used by the client SMTP to request connection 2237 closure, even when no session opening command was sent and accepted. 2239 4.1.5. Private-Use Commands 2241 As specified in Section 2.2.2, commands starting in "X" may be used 2242 by bilateral agreement between the client (sending) and server 2243 (receiving) SMTP agents. An SMTP server that does not recognize such 2244 a command is expected to reply with "500 Command not recognized". An 2245 extended SMTP server MAY list the feature names associated with these 2246 private commands in the response to the EHLO command. 2248 Commands sent or accepted by SMTP systems that do not start with "X" 2249 MUST conform to the requirements of Section 2.2.2. 2251 4.2. SMTP Replies 2253 Replies to SMTP commands serve to ensure the synchronization of 2254 requests and actions in the process of mail transfer and to guarantee 2255 that the SMTP client always knows the state of the SMTP server. 2256 Every command MUST generate exactly one reply. 2258 The details of the command-reply sequence are described in 2259 Section 4.3. 2261 An SMTP reply consists of a three digit number (transmitted as three 2262 numeric characters) followed by some text unless specified otherwise 2263 in this document. The number is for use by automata to determine 2264 what state to enter next; the text is for the human user. The three 2265 digits contain enough encoded information that the SMTP client need 2266 not examine the text and may either discard it or pass it on to the 2267 user, as appropriate. Exceptions are as noted elsewhere in this 2268 document. In particular, the 220, 221, 251, 421, and 551 reply codes 2269 are associated with message text that must be parsed and interpreted 2270 by machines. In the general case, the text may be receiver dependent 2271 and context dependent, so there are likely to be varying texts for 2272 each reply code. A discussion of the theory of reply codes is given 2273 in Section 4.2.1. Formally, a reply is defined to be the sequence: a 2274 three-digit code, , one line of text, and , or a multiline 2275 reply (as defined in the same section). Since, in violation of this 2276 specification, the text is sometimes not sent, clients that do not 2277 receive it SHOULD be prepared to process the code alone (with or 2278 without a trailing space character). Only the EHLO, EXPN, and HELP 2279 commands are expected to result in multiline replies in normal 2280 circumstances; however, multiline replies are allowed for any 2281 command. 2283 In ABNF, server responses are: 2285 Greeting = ( "220 " (Domain / address-literal) 2286 [ SP textstring ] CRLF ) / 2287 ( "220-" (Domain / address-literal) 2288 [ SP textstring ] CRLF 2289 *( "220-" [ textstring ] CRLF ) 2290 "220" [ SP textstring ] CRLF ) 2292 textstring = 1*(%d09 / %d32-126) ; HT, SP, Printable US-ASCII 2294 Reply-line = *( Reply-code "-" [ textstring ] CRLF ) 2295 Reply-code [ SP textstring ] CRLF 2297 Reply-code = %x32-35 %x30-35 %x30-39 2299 where "Greeting" appears only in the 220 response that announces that 2300 the server is opening its part of the connection. (Other possible 2301 server responses upon connection follow the syntax of Reply-line.) 2303 An SMTP server SHOULD send only the reply codes listed in this 2304 document or additions to the list as discussed below. 2305 [[CREF15: [5321bis] 20140804: New text to clear up ambiguity.]] 2306 An SMTP server SHOULD use the text shown in the examples whenever 2307 appropriate. 2309 An SMTP client MUST determine its actions only by the reply code, not 2310 by the text (except for the "change of address" 251 and 551 and, if 2311 necessary, 220, 221, and 421 replies); in the general case, any text, 2312 including no text at all (although senders SHOULD NOT send bare 2313 codes), MUST be acceptable. The space (blank) following the reply 2314 code is considered part of the text. A Sender-SMTP MUST first test 2315 the whole 3 digit reply code it receives, as well as any accompanying 2316 supplemental codes or information (see RFC 3463 [RFC3463] and RFC 2317 5248 [RFC5248]). If the full reply code is not recognized, and the 2318 additional information is not recognized or missing, the Sender-SMTP 2319 MUST use the first digit (severity indication) of a reply code it 2320 receives. 2322 The list of codes that appears below MUST NOT be construed as 2323 permanent. While the addition of new codes should be a rare and 2324 significant activity, with supplemental information in the textual 2325 part of the response (including enhanced status codes [34] and the 2326 successors to that specification) 2327 [[CREF16: [5321bis] 20140802: New text for clarity]] 2328 being preferred, new codes may be added as the result of new 2329 Standards or Standards-Track specifications. Consequently, a sender- 2330 SMTP MUST be prepared to handle codes not specified in this document 2331 and MUST do so by interpreting the first digit only. 2333 In the absence of extensions negotiated with the client, SMTP servers 2334 MUST NOT send reply codes whose first digits are other than 2, 3, 4, 2335 or 5. Clients that receive such out-of-range codes SHOULD normally 2336 treat them as fatal errors and terminate the mail transaction. 2338 4.2.1. Reply Code Severities and Theory 2340 The three digits of the reply each have a special significance. The 2341 first digit denotes whether the response is good, bad, or incomplete. 2342 An unsophisticated SMTP client, or one that receives an unexpected 2343 code, will be able to determine its next action (proceed as planned, 2344 redo, retrench, etc.) by examining this first digit. An SMTP client 2345 that wants to know approximately what kind of error occurred (e.g., 2346 mail system error, command syntax error) may examine the second 2347 digit. The third digit and any supplemental information that may be 2348 present is reserved for the finest gradation of information. 2350 There are four values for the first digit of the reply code: 2352 2yz Positive Completion reply 2353 The requested action has been successfully completed. A new 2354 request may be initiated. 2356 3yz Positive Intermediate reply 2357 The command has been accepted, but the requested action is being 2358 held in abeyance, pending receipt of further information. The 2359 SMTP client should send another command specifying this 2360 information. This reply is used in command sequence groups (i.e., 2361 in DATA). 2363 4yz Transient Negative Completion reply 2364 The command was not accepted, and the requested action did not 2365 occur. However, the error condition is temporary, and the action 2366 may be requested again. The sender should return to the beginning 2367 of the command sequence (if any). It is difficult to assign a 2368 meaning to "transient" when two different sites (receiver- and 2369 sender-SMTP agents) must agree on the interpretation. Each reply 2370 in this category might have a different time value, but the SMTP 2371 client SHOULD try again. A rule of thumb to determine whether a 2372 reply fits into the 4yz or the 5yz category (see below) is that 2373 replies are 4yz if they can be successful if repeated without any 2374 change in command form or in properties of the sender or receiver 2375 (that is, the command is repeated identically and the receiver 2376 does not put up a new implementation). 2378 5yz Permanent Negative Completion reply 2379 The command was not accepted and the requested action did not 2380 occur. The SMTP client SHOULD NOT repeat the exact request (in 2381 the same sequence). Even some "permanent" error conditions can be 2382 corrected, so the human user may want to direct the SMTP client to 2383 reinitiate the command sequence by direct action at some point in 2384 the future (e.g., after the spelling has been changed, or the user 2385 has altered the account status). 2387 It is worth noting that the file transfer protocol (FTP) [14] uses a 2388 very similar code architecture and that the SMTP codes are based on 2389 the FTP model. However, SMTP uses a one-command, one-response model 2390 (while FTP is asynchronous) and FTP's 1yz codes are not part of the 2391 SMTP model. 2393 The second digit encodes responses in specific categories: 2395 x0z Syntax: These replies refer to syntax errors, syntactically 2396 correct commands that do not fit any functional category, and 2397 unimplemented or superfluous commands. 2399 x1z Information: These are replies to requests for information, such 2400 as status or help. 2402 x2z Connections: These are replies referring to the transmission 2403 channel. 2405 x3z Unspecified. 2407 x4z Unspecified. 2409 x5z Mail system: These replies indicate the status of the receiver 2410 mail system vis-a-vis the requested transfer or other mail system 2411 action. 2413 The third digit gives a finer gradation of meaning in each category 2414 specified by the second digit. The list of replies illustrates this. 2415 Each reply text is recommended rather than mandatory, and may even 2416 change according to the command with which it is associated. On the 2417 other hand, the reply codes must strictly follow the specifications 2418 in this section. Receiver implementations should not invent new 2419 codes for slightly different situations from the ones described here, 2420 but rather adapt codes already defined. 2422 For example, a command such as NOOP, whose successful execution does 2423 not offer the SMTP client any new information, will return a 250 2424 reply. The reply is 502 when the command requests an unimplemented 2425 non-site-specific action. A refinement of that is the 504 reply for 2426 a command that is implemented, but that requests an unimplemented 2427 parameter. 2429 The reply text may be longer than a single line; in these cases the 2430 complete text must be marked so the SMTP client knows when it can 2431 stop reading the reply. This requires a special format to indicate a 2432 multiple line reply. 2434 The format for multiline replies requires that every line, except the 2435 last, begin with the reply code, followed immediately by a hyphen, 2436 "-" (also known as minus), followed by text. The last line will 2437 begin with the reply code, followed immediately by , optionally 2438 some text, and . As noted above, servers SHOULD send the 2439 if subsequent text is not sent, but clients MUST be prepared for it 2440 to be omitted. 2442 For example: 2444 250-First line 2445 250-Second line 2446 250-234 Text beginning with numbers 2447 250 The last line 2449 In a multiline reply, the reply code on each of the lines MUST be the 2450 same. It is reasonable for the client to rely on this, so it can 2451 make processing decisions based on the code in any line, assuming 2452 that all others will be the same. In a few cases, there is important 2453 data for the client in the reply "text". The client will be able to 2454 identify these cases from the current context. 2456 4.2.2. Reply Codes by Function Groups 2458 500 Syntax error, command unrecognized (This may include errors such 2459 as command line too long) 2461 501 Syntax error in parameters or arguments 2463 502 Command not implemented (see Section 4.2.4.1) 2465 503 Bad sequence of commands 2466 504 Command parameter not implemented 2468 211 System status, or system help reply 2470 214 Help message (Information on how to use the receiver or the 2471 meaning of a particular non-standard command; this reply is useful 2472 only to the human user) 2474 220 Service ready 2476 221 Service closing transmission channel 2478 421 Service not available, closing transmission channel 2479 (This may be a reply to any command if the service knows it must 2480 shut down) 2482 521 No mail service here. [[CREF17: [5321bis]20140804: 2483 Specific code introduced with RFC 1846, updated and specified in 2484 draft-klensin-smtp-521code.]] 2486 556 No mail service at this domain. [[CREF18: [5321bis] 20140912: 2487 Specific code introduced in draft-klensin-smtp-521code-02 (RFC 2488 7504), largely for nullMX]] 2490 250 Requested mail action okay, completed 2492 251 User not local; will forward to (See Section 3.4) 2494 252 Cannot VRFY user, but will accept message and attempt delivery 2495 (See Section 3.5.3) 2497 455 Server unable to accommodate parameters 2499 555 MAIL FROM/RCPT TO parameters not recognized or not implemented 2501 450 Requested mail action not taken: mailbox unavailable (e.g., 2502 mailbox busy or temporarily blocked for policy reasons) 2504 550 Requested action not taken: mailbox unavailable (e.g., mailbox 2505 not found, no access, or command rejected for policy reasons) 2507 451 Requested action aborted: error in processing 2509 551 User not local; please try (See Section 3.4) 2510 452 Requested action not taken: insufficient system storage 2512 552 Requested mail action aborted: exceeded storage allocation 2514 553 Requested action not taken: mailbox name not allowed (e.g., 2515 mailbox syntax incorrect) 2517 354 Start mail input; end with . 2519 554 Transaction failed (Or, in the case of a connection-opening 2520 response, "No SMTP service here") 2521 [[CREF19: [5321bis] [[Note in Draft: Revise above statement in the 2522 light of new 521 code??]] ]] 2524 4.2.3. Reply Codes in Numeric Order 2526 211 System status, or system help reply 2528 214 Help message (Information on how to use the receiver or the 2529 meaning of a particular non-standard command; this reply is useful 2530 only to the human user) 2532 220 Service ready 2534 221 Service closing transmission channel 2536 250 Requested mail action okay, completed 2538 251 User not local; will forward to (See Section 3.4) 2540 252 Cannot VRFY user, but will accept message and attempt delivery 2541 (See Section 3.5.3) 2543 354 Start mail input; end with . 2545 421 Service not available, closing transmission channel 2546 (This may be a reply to any command if the service knows it must 2547 shut down) 2549 450 Requested mail action not taken: mailbox unavailable (e.g., 2550 mailbox busy or temporarily blocked for policy reasons) 2552 451 Requested action aborted: local error in processing 2553 452 Requested action not taken: insufficient system storage 2555 455 Server unable to accommodate parameters 2557 500 Syntax error, command unrecognized (This may include errors such 2558 as command line too long) 2560 501 Syntax error in parameters or arguments 2562 502 Command not implemented (see Section 4.2.4.1) 2564 503 Bad sequence of commands 2566 504 Command parameter not implemented 2568 521 No mail service 2570 550 Requested action not taken: mailbox unavailable (e.g., mailbox 2571 not found, no access, or command rejected for policy reasons) 2573 551 User not local; please try (See Section 3.4) 2575 552 Requested mail action aborted: exceeded storage allocation 2577 553 Requested action not taken: mailbox name not allowed (e.g., 2578 mailbox syntax incorrect) 2580 554 Transaction failed (Or, in the case of a connection-opening 2581 response, "No SMTP service here") 2583 555 MAIL FROM/RCPT TO parameters not recognized or not implemented 2585 556 No mail service at this domain. 2587 4.2.4. Some specific code situations and relationships 2589 4.2.4.1. Reply Code 502 2591 Questions have been raised as to when reply code 502 (Command not 2592 implemented) SHOULD be returned in preference to other codes. 502 2593 SHOULD be used when the command is actually recognized by the SMTP 2594 server, but not implemented. If the command is not recognized, code 2595 500 SHOULD be returned. Extended SMTP systems MUST NOT list 2596 capabilities in response to EHLO for which they will return 502 (or 2597 500) replies. 2599 4.2.4.2. "No mail accepted" situations and the 521, 554, and 556 codes 2601 [[CREF20: [5321bis] This section is new with 5321bis. ]] 2603 Codes 521, 554, and 556 are all used to report different types of "no 2604 mail accepted" situations. They differ as follows. 521 is an 2605 indication from a system answering on the SMTP port that it does not 2606 support SMTP service (a so-called "dummy server" as discussed in RFC 2607 1846 [19] and elsewhere). Obviously, it requires that system exist 2608 and that a connection can be made successfully to it. Because a 2609 system that does not accept any mail cannot meaningfully accept a 2610 RCPT command, any commands (other than QUIT) issued after an SMTP 2611 server has issued a 521 reply are client (sender) errors. 556 is 2612 used by a message submission or intermediate SMTP system (see 2613 Section 1.1) to report that it cannot forward the message further 2614 because it knows (e.g., from a DNS entry [51]) that the recipient 2615 domain does not accept mail. It would normally be used in response 2616 to a RCPT or similar (extension) command when the SMTP system 2617 identifies a domain that it can (or has) determined never accepts 2618 mail. Other codes, including 554 and the temporary 450, are used for 2619 more transient situations and situations in which an SMTP server 2620 cannot or will not deliver to (or accept mail for) a particular 2621 system or mailbox for policy reasons rather than ones directly 2622 related to SMTP processing. 2624 4.2.4.3. Reply Codes after DATA and the Subsequent . 2626 When an SMTP server returns a positive completion status (2yz code) 2627 after the DATA command is completed with ., it accepts 2628 responsibility for: 2630 o delivering the message (if the recipient mailbox exists), or 2632 o if attempts to deliver the message fail due to transient 2633 conditions, retrying delivery some reasonable number of times at 2634 intervals as specified in Section 4.5.4. 2636 o if attempts to deliver the message fail due to permanent 2637 conditions, or if repeated attempts to deliver the message fail 2638 due to transient conditions, returning appropriate notification to 2639 the sender of the original message (using the address in the SMTP 2640 MAIL command). 2642 When an SMTP server returns a temporary error status (4yz) code after 2643 the DATA command is completed with ., it MUST NOT make a 2644 subsequent attempt to deliver that message. The SMTP client retains 2645 responsibility for the delivery of that message and may either return 2646 it to the user or requeue it for a subsequent attempt (see 2647 Section 4.5.4.1). 2649 The user who originated the message SHOULD be able to interpret the 2650 return of a transient failure status (by mail message or otherwise) 2651 as a non-delivery indication, just as a permanent failure would be 2652 interpreted. If the client SMTP successfully handles these 2653 conditions, the user will not receive such a reply. 2655 When an SMTP server returns a permanent error status (5yz) code after 2656 the DATA command is completed with ., it MUST NOT make 2657 any subsequent attempt to deliver the message. As with temporary 2658 error status codes, the SMTP client retains responsibility for the 2659 message, but SHOULD NOT again attempt delivery to the same server 2660 without user review of the message and response and appropriate 2661 intervention. 2663 4.3. Sequencing of Commands and Replies 2665 4.3.1. Sequencing Overview 2667 The communication between the sender and receiver is an alternating 2668 dialogue, controlled by the sender. As such, the sender issues a 2669 command and the receiver responds with a reply. Unless other 2670 arrangements are negotiated through service extensions, the sender 2671 MUST wait for this response before sending further commands. One 2672 important reply is the connection greeting. Normally, a receiver 2673 will send a 220 "Service ready" reply when the connection is 2674 completed. The sender SHOULD wait for this greeting message before 2675 sending any commands. 2677 Note: all the greeting-type replies have the official name (the 2678 fully-qualified primary domain name) of the server host as the first 2679 word following the reply code. Sometimes the host will have no 2680 meaningful name. See Section 4.1.3 for a discussion of alternatives 2681 in these situations. 2683 For example, 2685 220 ISIF.USC.EDU Service ready 2687 or 2689 220 mail.example.com SuperSMTP v 6.1.2 Service ready 2691 or 2693 220 [10.0.0.1] Clueless host service ready 2695 The table below lists alternative success and failure replies for 2696 each command. These SHOULD be strictly adhered to. A receiver MAY 2697 substitute text in the replies, but the meanings and actions implied 2698 by the code numbers and by the specific command reply sequence MUST 2699 be preserved. However, in order to provide robustness as SMTP is 2700 extended and evolves, the discussion in Section 4.2.1 still applies: 2701 all SMTP clients MUST be prepared to accept any code that conforms to 2702 the discussion in that section and MUST be prepared to interpret it 2703 on the basis of its first digit only. 2705 4.3.2. Command-Reply Sequences 2707 Each command is listed with its usual possible replies. The prefixes 2708 used before the possible replies are "I" for intermediate, "S" for 2709 success, and "E" for error. Since some servers may generate other 2710 replies under special circumstances, and to allow for future 2711 extension, SMTP clients SHOULD, when possible, interpret only the 2712 first digit of the reply and MUST be prepared to deal with 2713 unrecognized reply codes by interpreting the first digit only. 2714 Unless extended using the mechanisms described in Section 2.2, SMTP 2715 servers MUST NOT transmit reply codes to an SMTP client that are 2716 other than three digits or that do not start in a digit between 2 and 2717 5 inclusive. 2719 These sequencing rules and, in principle, the codes themselves, can 2720 be extended or modified by SMTP extensions offered by the server and 2721 accepted (requested) by the client. However, if the target is more 2722 precise granularity in the codes, rather than codes for completely 2723 new purposes, the system described in RFC 3463 [34] SHOULD be used in 2724 preference to the invention of new codes. 2726 In addition to the codes listed below, any SMTP command can return 2727 any of the following codes if the corresponding unusual circumstances 2728 are encountered: 2730 500 For the "command line too long" case or if the command name was 2731 not recognized. Note that producing a "command not recognized" 2732 error in response to the required subset of these commands is a 2733 violation of this specification. Similarly, producing a "command 2734 too long" message for a command line shorter than 512 characters 2735 would violate the provisions of Section 4.5.3.1.4. 2737 501 Syntax error in command or arguments. In order to provide for 2738 future extensions, commands that are specified in this document as 2739 not accepting arguments (DATA, RSET, QUIT) SHOULD return a 501 2740 message if arguments are supplied in the absence of EHLO- 2741 advertised extensions. 2743 421 Service shutting down and closing transmission channel 2745 Specific sequences are: 2747 CONNECTION ESTABLISHMENT 2749 S: 220 2750 E: 521, 554 2752 EHLO or HELO 2754 S: 250 2755 E: 504 (a conforming implementation could return this code only 2756 in fairly obscure cases), 550, 502 (permitted only with an old- 2757 style server that does not support EHLO) 2759 MAIL 2761 S: 250 2762 E: 552, 451, 452, 550, 553, 503, 455, 555 2764 RCPT 2766 S: 250, 251 (but see Section 3.4 for discussion of 251 and 551) 2767 E: 550, 551, 552, 553, 450, 451, 452, 503, 455, 555 2769 DATA 2771 I: 354 -> data -> S: 250 2773 E: 552, 554, 451, 452 2775 E: 450, 550 (rejections for policy reasons) 2777 E: 503, 554 2779 RSET 2781 S: 250 2783 VRFY 2785 S: 250, 251, 252 2786 E: 550, 551, 553, 502, 504 2788 EXPN 2789 S: 250, 252 2790 E: 550, 500, 502, 504 2792 HELP 2794 S: 211, 214 2795 E: 502, 504 2797 NOOP 2799 S: 250 2801 QUIT 2803 S: 221 2805 4.4. Trace Information 2807 When an SMTP server receives a message for delivery or further 2808 processing, it MUST insert trace (often referred to as "time stamp" 2809 or "Received" information) beginning of the message content, as 2810 discussed in Section 4.1.1.4. 2812 This line MUST be structured as follows: 2814 o The FROM clause, which MUST be supplied in an SMTP environment, 2815 SHOULD contain both (1) the name of the source host as presented 2816 in the EHLO command and (2) an address literal containing the IP 2817 address of the source, determined from the TCP connection. 2819 o The ID clause MAY contain an "@" as suggested in RFC 822, but this 2820 is not required. 2822 o If the FOR clause appears, it MUST contain exactly one 2823 entry, even when multiple RCPT commands have been given. Multiple 2824 s raise some security issues and have been deprecated, see 2825 Section 7.2. 2827 An Internet mail program MUST NOT change or delete a Received: line 2828 that was previously added to the message header section. SMTP 2829 servers MUST prepend Received lines to messages; they MUST NOT change 2830 the order of existing lines or insert Received lines in any other 2831 location. 2833 As the Internet grows, comparability of Received header fields is 2834 important for detecting problems, especially slow relays. SMTP 2835 servers that create Received header fields SHOULD use explicit 2836 offsets in the dates (e.g., -0800), rather than time zone names of 2837 any type. Local time (with an offset) SHOULD be used rather than UT 2838 when feasible. This formulation allows slightly more information 2839 about local circumstances to be specified. If UT is needed, the 2840 receiver need merely do some simple arithmetic to convert the values. 2841 Use of UT loses information about the time zone-location of the 2842 server. If it is desired to supply a time zone name, it SHOULD be 2843 included in a comment. 2845 When the delivery SMTP server makes the "final delivery" of a 2846 message, it inserts a return-path line at the beginning of the mail 2847 data. This use of return-path is required; mail systems MUST support 2848 it. The return-path line preserves the information in the from the MAIL command. Here, final delivery means the message 2850 has left the SMTP environment. Normally, this would mean it had been 2851 delivered to the destination user or an associated mail drop, but in 2852 some cases it may be further processed and transmitted by another 2853 mail system. 2855 It is possible for the mailbox in the return path to be different 2856 from the actual sender's mailbox, for example, if error responses are 2857 to be delivered to a special error handling mailbox rather than to 2858 the message sender. When mailing lists are involved, this 2859 arrangement is common and useful as a means of directing errors to 2860 the list maintainer rather than the message originator. 2862 The text above implies that the final mail data will begin with a 2863 return path line, followed by one or more time stamp lines. These 2864 lines will be followed by the rest of the mail data: first the 2865 balance of the mail header section and then the body (RFC 5322 [11]). 2867 It is sometimes difficult for an SMTP server to determine whether or 2868 not it is making final delivery since forwarding or other operations 2869 may occur after the message is accepted for delivery. Consequently, 2870 any further (forwarding, gateway, or relay) systems MAY remove the 2871 return path and rebuild the MAIL command as needed to ensure that 2872 exactly one such line appears in a delivered message. 2874 A message-originating SMTP system SHOULD NOT send a message that 2875 already contains a Return-path header field. SMTP servers performing 2876 a relay function MUST NOT inspect the message data, and especially 2877 not to the extent needed to determine if Return-path header fields 2878 are present. SMTP servers making final delivery MAY remove Return- 2879 path header fields before adding their own. 2881 The primary purpose of the Return-path is to designate the address to 2882 which messages indicating non-delivery or other mail system failures 2883 are to be sent. For this to be unambiguous, exactly one return path 2884 SHOULD be present when the message is delivered. Systems using RFC 2885 822 syntax with non-SMTP transports SHOULD designate an unambiguous 2886 address, associated with the transport envelope, to which error 2887 reports (e.g., non-delivery messages) should be sent. 2889 Historical note: Text in RFC 822 that appears to contradict the use 2890 of the Return-path header field (or the envelope reverse-path address 2891 from the MAIL command) as the destination for error messages is not 2892 applicable on the Internet. The reverse-path address (as copied into 2893 the Return-path) MUST be used as the target of any mail containing 2894 delivery error messages. 2896 In particular: 2898 o a gateway from SMTP -> elsewhere SHOULD insert a return-path 2899 header field, unless it is known that the "elsewhere" transport 2900 also uses Internet domain addresses and maintains the envelope 2901 sender address separately. 2903 o a gateway from elsewhere -> SMTP SHOULD delete any return-path 2904 header field present in the message, and either copy that 2905 information to the SMTP envelope or combine it with information 2906 present in the envelope of the other transport system to construct 2907 the reverse-path argument to the MAIL command in the SMTP 2908 envelope. 2910 The server must give special treatment to cases in which the 2911 processing following the end of mail data indication is only 2912 partially successful. This could happen if, after accepting several 2913 recipients and the mail data, the SMTP server finds that the mail 2914 data could be successfully delivered to some, but not all, of the 2915 recipients. In such cases, the response to the DATA command MUST be 2916 an OK reply. However, the SMTP server MUST compose and send an 2917 "undeliverable mail" notification message to the originator of the 2918 message. 2920 A single notification listing all of the failed recipients or 2921 separate notification messages MUST be sent for each failed 2922 recipient. For economy of processing by the sender, the former 2923 SHOULD be used when possible. Note that the key difference between 2924 handling aliases (Section 3.9.1) and forwarding (this subsection) is 2925 the change to the backward-pointing address in this case. All 2926 notification messages about undeliverable mail MUST be sent using the 2927 MAIL command and MUST use a null return path as discussed in 2928 Section 3.6. 2930 The time stamp line and the return path line are formally defined as 2931 follows (the definitions for "FWS" and "CFWS" appear in RFC 5322 2932 [11]): 2934 Return-path-line = "Return-Path:" FWS Reverse-path 2936 Time-stamp-line = "Received:" FWS Stamp 2938 Stamp = From-domain By-domain Opt-info [CFWS] ";" 2939 FWS date-time 2940 ; where "date-time" is as defined in RFC 5322 [11] 2941 ; but the "obs-" forms, especially two-digit 2942 ; years, are prohibited in SMTP and MUST NOT be used. 2944 From-domain = "FROM" FWS Extended-Domain 2946 By-domain = CFWS "BY" FWS Extended-Domain 2948 Extended-Domain = Domain / 2949 ( Domain FWS "(" TCP-info ")" ) / 2950 ( address-literal FWS "(" TCP-info ")" ) 2952 TCP-info = address-literal / ( Domain FWS address-literal ) 2953 ; Information derived by server from TCP connection 2954 ; not client EHLO. 2956 Opt-info = [Via] [With] [ID] [For] 2957 [Additional-Registered-Clauses] 2959 Via = CFWS "VIA" FWS Link 2961 With = CFWS "WITH" FWS Protocol 2963 ID = CFWS "ID" FWS ( Atom / msg-id ) 2964 ; msg-id is defined in RFC 5322 [11] 2966 For = CFWS "FOR" FWS ( Path / Mailbox ) 2968 Additional-Registered-Clauses = 1* (CFWS Atom FWS String) 2969 [[CREF21: [5321bis] 5321 errata #1683, 20090215, 2970 Roberto Javier Godoy, rjgodoy@fich.unl.edu.ar]] 2971 ; Additional standard clauses may be added in this 2972 ; location by future standards and registration with 2973 ; IANA. SMTP servers SHOULD NOT use unregistered 2974 ; names. See Section 8. 2976 Link = "TCP" / Addtl-Link 2978 Addtl-Link = Atom 2979 ; Additional standard names for links are 2980 ; registered with the Internet Assigned Numbers 2981 ; Authority (IANA). "Via" is primarily of value 2982 ; with non-Internet transports. SMTP servers 2983 ; SHOULD NOT use unregistered names. 2985 Protocol = "ESMTP" / "SMTP" / Attdl-Protocol 2987 Addtl-Protocol = Atom 2988 ; Additional standard names for protocols are 2989 ; registered with the Internet Assigned Numbers 2990 ; Authority (IANA) in the "mail parameters" 2991 ; registry [7]. SMTP servers SHOULD NOT 2992 ; use unregistered names. 2994 4.5. Additional Implementation Issues 2996 4.5.1. Minimum Implementation 2998 In order to make SMTP workable, the following minimum implementation 2999 MUST be provided by all receivers. The following commands MUST be 3000 supported to conform to this specification: 3002 EHLO 3003 HELO 3004 MAIL 3005 RCPT 3006 DATA 3007 RSET 3008 NOOP 3009 QUIT 3010 VRFY 3012 Any system that includes an SMTP server supporting mail relaying or 3013 delivery MUST support the reserved mailbox "postmaster" as a case- 3014 insensitive local name. This postmaster address is not strictly 3015 necessary if the server always returns 554 on connection opening (as 3016 described in Section 3.1). The requirement to accept mail for 3017 postmaster implies that RCPT commands that specify a mailbox for 3018 postmaster at any of the domains for which the SMTP server provides 3019 mail service, as well as the special case of "RCPT TO:" 3020 (with no domain specification), MUST be supported. 3022 SMTP systems are expected to make every reasonable effort to accept 3023 mail directed to Postmaster from any other system on the Internet. 3024 In extreme cases -- such as to contain a denial of service attack or 3025 other breach of security -- an SMTP server may block mail directed to 3026 Postmaster. However, such arrangements SHOULD be narrowly tailored 3027 so as to avoid blocking messages that are not part of such attacks. 3029 4.5.2. Transparency 3031 Without some provision for data transparency, the character sequence 3032 "." ends the mail text and cannot be sent by the user. 3033 In general, users are not aware of such "forbidden" sequences. To 3034 allow all user composed text to be transmitted transparently, the 3035 following procedures are used: 3037 o Before sending a line of mail text, the SMTP client checks the 3038 first character of the line. If it is a period, one additional 3039 period is inserted at the beginning of the line. 3041 o When a line of mail text is received by the SMTP server, it checks 3042 the line. If the line is composed of a single period, it is 3043 treated as the end of mail indicator. If the first character is a 3044 period and there are other characters on the line, the first 3045 character is deleted. 3047 The mail data may contain any of the 128 ASCII characters. All 3048 characters are to be delivered to the recipient's mailbox, including 3049 spaces, vertical and horizontal tabs, and other control characters. 3050 If the transmission channel provides an 8-bit byte (octet) data 3051 stream, the 7-bit ASCII codes are transmitted, right justified, in 3052 the octets, with the high-order bits cleared to zero. See 3053 Section 3.6 for special treatment of these conditions in SMTP systems 3054 serving a relay function. 3056 In some systems, it may be necessary to transform the data as it is 3057 received and stored. This may be necessary for hosts that use a 3058 different character set than ASCII as their local character set, that 3059 store data in records rather than strings, or which use special 3060 character sequences as delimiters inside mailboxes. If such 3061 transformations are necessary, they MUST be reversible, especially if 3062 they are applied to mail being relayed. 3064 4.5.3. Sizes and Timeouts 3066 4.5.3.1. Size Limits and Minimums 3068 There are several objects that have required minimum/maximum sizes. 3069 Every implementation MUST be able to receive objects of at least 3070 these sizes. Objects larger than these sizes SHOULD be avoided when 3071 possible. However, some Internet mail constructs such as encoded 3072 X.400 addresses (RFC 2156 [26]) will often require larger objects. 3073 Clients MAY attempt to transmit these, but MUST be prepared for a 3074 server to reject them if they cannot be handled by it. To the 3075 maximum extent possible, implementation techniques that impose no 3076 limits on the length of these objects should be used. 3078 Extensions to SMTP may involve the use of characters that occupy more 3079 than a single octet each. This section therefore specifies lengths 3080 in octets where absolute lengths, rather than character counts, are 3081 intended. 3083 [[CREF22: [5321bis] [[Note in Draft: Klensin 20191126: Given the 3084 controversy on the SMTP mailing list between 20191123 and now about 3085 maximum lengths, is the above adequate or is further tuning of the 3086 limit text below needed? ]]]] 3088 4.5.3.1.1. Local-part 3090 The maximum total length of a user name or other local-part is 64 3091 octets. 3093 4.5.3.1.2. Domain 3095 The maximum total length of a domain name or number is 255 octets. 3097 4.5.3.1.3. Path 3099 The maximum total length of a reverse-path or forward-path is 256 3100 octets (including the punctuation and element separators). 3102 4.5.3.1.4. Command Line 3104 The maximum total length of a command line including the command word 3105 and the is 512 octets. SMTP extensions may be used to 3106 increase this limit. 3108 4.5.3.1.5. Reply Line 3110 The maximum total length of a reply line including the reply code and 3111 the is 512 octets. More information may be conveyed through 3112 multiple-line replies. 3114 4.5.3.1.6. Text Line 3116 The maximum total length of a text line including the is 1000 3117 octets (not counting the leading dot duplicated for transparency). 3118 This number may be increased by the use of SMTP Service Extensions. 3120 4.5.3.1.7. Message Content 3122 The maximum total length of a message content (including any message 3123 header section as well as the message body) MUST BE at least 64K 3124 octets. Since the introduction of Internet Standards for multimedia 3125 mail (RFC 2045 [24]), message lengths on the Internet have grown 3126 dramatically, and message size restrictions should be avoided if at 3127 all possible. SMTP server systems that must impose restrictions 3128 SHOULD implement the "SIZE" service extension of RFC 1870 [6], and 3129 SMTP client systems that will send large messages SHOULD utilize it 3130 when possible. 3132 4.5.3.1.8. Recipient Buffer 3134 The minimum total number of recipients that MUST be buffered is 100 3135 recipients. Rejection of messages (for excessive recipients) with 3136 fewer than 100 RCPT commands is a violation of this specification. 3137 The general principle that relaying SMTP server MUST NOT, and 3138 delivery SMTP servers SHOULD NOT, perform validation tests on message 3139 header fields suggests that messages SHOULD NOT be rejected based on 3140 the total number of recipients shown in header fields. A server that 3141 imposes a limit on the number of recipients MUST behave in an orderly 3142 fashion, such as rejecting additional addresses over its limit rather 3143 than silently discarding addresses previously accepted. A client 3144 that needs to deliver a message containing over 100 RCPT commands 3145 SHOULD be prepared to transmit in 100-recipient "chunks" if the 3146 server declines to accept more than 100 recipients in a single 3147 message. 3149 4.5.3.1.9. Treatment When Limits Exceeded 3151 Errors due to exceeding these limits may be reported by using the 3152 reply codes. Some examples of reply codes are: 3154 500 Line too long. 3156 or 3158 501 Path too long 3160 or 3162 452 Too many recipients (see below) 3164 or 3166 552 Too much mail data. 3168 4.5.3.1.10. Too Many Recipients Code 3170 RFC 821 [3] incorrectly listed the error where an SMTP server 3171 exhausts its implementation limit on the number of RCPT commands 3172 ("too many recipients") as having reply code 552. The correct reply 3173 code for this condition is 452. Clients SHOULD treat a 552 code in 3174 this case as a temporary, rather than permanent, failure so the logic 3175 below works. 3177 When a conforming SMTP server encounters this condition, it has at 3178 least 100 successful RCPT commands in its recipient buffer. If the 3179 server is able to accept the message, then at least these 100 3180 addresses will be removed from the SMTP client's queue. When the 3181 client attempts retransmission of those addresses that received 452 3182 responses, at least 100 of these will be able to fit in the SMTP 3183 server's recipient buffer. Each retransmission attempt that is able 3184 to deliver anything will be able to dispose of at least 100 of these 3185 recipients. 3187 If an SMTP server has an implementation limit on the number of RCPT 3188 commands and this limit is exhausted, it MUST use a response code of 3189 452 (but the client SHOULD also be prepared for a 552, as noted 3190 above). If the server has a configured site-policy limitation on the 3191 number of RCPT commands, it MAY instead use a 5yz response code. In 3192 particular, if the intent is to prohibit messages with more than a 3193 site-specified number of recipients, rather than merely limit the 3194 number of recipients in a given mail transaction, it would be 3195 reasonable to return a 503 response to any DATA command received 3196 subsequent to the 452 (or 552) code or to simply return the 503 after 3197 DATA without returning any previous negative response. 3199 4.5.3.2. Timeouts 3201 An SMTP client MUST provide a timeout mechanism. It MUST use per- 3202 command timeouts rather than somehow trying to time the entire mail 3203 transaction. Timeouts SHOULD be easily reconfigurable, preferably 3204 without recompiling the SMTP code. To implement this, a timer is set 3205 for each SMTP command and for each buffer of the data transfer. The 3206 latter means that the overall timeout is inherently proportional to 3207 the size of the message. 3209 Based on extensive experience with busy mail-relay hosts, the minimum 3210 per-command timeout values SHOULD be as follows: 3212 4.5.3.2.1. Initial 220 Message: 5 Minutes 3214 An SMTP client process needs to distinguish between a failed TCP 3215 connection and a delay in receiving the initial 220 greeting message. 3216 Many SMTP servers accept a TCP connection but delay delivery of the 3217 220 message until their system load permits more mail to be 3218 processed. 3220 4.5.3.2.2. MAIL Command: 5 Minutes 3222 4.5.3.2.3. RCPT Command: 5 Minutes 3224 A longer timeout is required if processing of mailing lists and 3225 aliases is not deferred until after the message was accepted. 3227 4.5.3.2.4. DATA Initiation: 2 Minutes 3229 This is while awaiting the "354 Start Input" reply to a DATA command. 3231 4.5.3.2.5. Data Block: 3 Minutes 3233 This is while awaiting the completion of each TCP SEND call 3234 transmitting a chunk of data. 3236 4.5.3.2.6. DATA Termination: 10 Minutes. 3238 This is while awaiting the "250 OK" reply. When the receiver gets 3239 the final period terminating the message data, it typically performs 3240 processing to deliver the message to a user mailbox. A spurious 3241 timeout at this point would be very wasteful and would typically 3242 result in delivery of multiple copies of the message, since it has 3243 been successfully sent and the server has accepted responsibility for 3244 delivery. See Section 6.1 for additional discussion. 3246 4.5.3.2.7. Server Timeout: 5 Minutes. 3248 An SMTP server SHOULD have a timeout of at least 5 minutes while it 3249 is awaiting the next command from the sender. 3251 4.5.4. Retry Strategies 3253 The common structure of a host SMTP implementation includes user 3254 mailboxes, one or more areas for queuing messages in transit, and one 3255 or more daemon processes for sending and receiving mail. The exact 3256 structure will vary depending on the needs of the users on the host 3257 and the number and size of mailing lists supported by the host. We 3258 describe several optimizations that have proved helpful, particularly 3259 for mailers supporting high traffic levels. 3261 Any queuing strategy MUST include timeouts on all activities on a 3262 per-command basis. A queuing strategy MUST NOT send error messages 3263 in response to error messages under any circumstances. 3265 4.5.4.1. Sending Strategy 3267 The general model for an SMTP client is one or more processes that 3268 periodically attempt to transmit outgoing mail. In a typical system, 3269 the program that composes a message has some method for requesting 3270 immediate attention for a new piece of outgoing mail, while mail that 3271 cannot be transmitted immediately MUST be queued and periodically 3272 retried by the sender. A mail queue entry will include not only the 3273 message itself but also the envelope information. 3275 The sender MUST delay retrying a particular destination after one 3276 attempt has failed. In general, the retry interval SHOULD be at 3277 least 30 minutes; however, more sophisticated and variable strategies 3278 will be beneficial when the SMTP client can determine the reason for 3279 non-delivery. 3281 Retries continue until the message is transmitted or the sender gives 3282 up; the give-up time generally needs to be at least 4-5 days. It MAY 3283 be appropriate to set a shorter maximum number of retries for non- 3284 delivery notifications and equivalent error messages than for 3285 standard messages. The parameters to the retry algorithm MUST be 3286 configurable. 3288 A client SHOULD keep a list of hosts it cannot reach and 3289 corresponding connection timeouts, rather than just retrying queued 3290 mail items. 3292 Experience suggests that failures are typically transient (the target 3293 system or its connection has crashed), favoring a policy of two 3294 connection attempts in the first hour the message is in the queue, 3295 and then backing off to one every two or three hours. 3297 The SMTP client can shorten the queuing delay in cooperation with the 3298 SMTP server. For example, if mail is received from a particular 3299 address, it is likely that mail queued for that host can now be sent. 3300 Application of this principle may, in many cases, eliminate the 3301 requirement for an explicit "send queues now" function such as ETRN, 3302 RFC 1985 [23]. 3304 The strategy may be further modified as a result of multiple 3305 addresses per host (see below) to optimize delivery time versus 3306 resource usage. 3308 An SMTP client may have a large queue of messages for each 3309 unavailable destination host. If all of these messages were retried 3310 in every retry cycle, there would be excessive Internet overhead and 3311 the sending system would be blocked for a long period. Note that an 3312 SMTP client can generally determine that a delivery attempt has 3313 failed only after a timeout of several minutes, and even a one-minute 3314 timeout per connection will result in a very large delay if retries 3315 are repeated for dozens, or even hundreds, of queued messages to the 3316 same host. 3318 At the same time, SMTP clients SHOULD use great care in caching 3319 negative responses from servers. In an extreme case, if EHLO is 3320 issued multiple times during the same SMTP connection, different 3321 answers may be returned by the server. More significantly, 5yz 3322 responses to the MAIL command MUST NOT be cached. 3324 When a mail message is to be delivered to multiple recipients, and 3325 the SMTP server to which a copy of the message is to be sent is the 3326 same for multiple recipients, then only one copy of the message 3327 SHOULD be transmitted. That is, the SMTP client SHOULD use the 3328 command sequence: MAIL, RCPT, RCPT, ..., RCPT, DATA instead of the 3329 sequence: MAIL, RCPT, DATA, ..., MAIL, RCPT, DATA. However, if there 3330 are very many addresses, a limit on the number of RCPT commands per 3331 MAIL command MAY be imposed. This efficiency feature SHOULD be 3332 implemented. 3334 Similarly, to achieve timely delivery, the SMTP client MAY support 3335 multiple concurrent outgoing mail transactions. However, some limit 3336 may be appropriate to protect the host from devoting all its 3337 resources to mail. 3339 4.5.4.2. Receiving Strategy 3341 The SMTP server SHOULD attempt to keep a pending listen on the SMTP 3342 port (specified by IANA as port 25) at all times. This requires the 3343 support of multiple incoming TCP connections for SMTP. Some limit 3344 MAY be imposed, but servers that cannot handle more than one SMTP 3345 transaction at a time are not in conformance with the intent of this 3346 specification. 3348 As discussed above, when the SMTP server receives mail from a 3349 particular host address, it could activate its own SMTP queuing 3350 mechanisms to retry any mail pending for that host address. 3352 4.5.5. Messages with a Null Reverse-Path 3354 There are several types of notification messages that are required by 3355 existing and proposed Standards to be sent with a null reverse-path, 3356 namely non-delivery notifications as discussed in Section 3.6.2 and 3357 Section 3.6.3, other kinds of Delivery Status Notifications (DSNs, 3358 RFC 3461 [33]), and Message Disposition Notifications (MDNs, RFC 8098 3359 [37]). All of these kinds of messages are notifications about a 3360 previous message, and they are sent to the reverse-path of the 3361 previous mail message. (If the delivery of such a notification 3362 message fails, that usually indicates a problem with the mail system 3363 of the host to which the notification message is addressed. For this 3364 reason, at some hosts the MTA is set up to forward such failed 3365 notification messages to someone who is able to fix problems with the 3366 mail system, e.g., via the postmaster alias.) 3368 All other types of messages (i.e., any message which is not required 3369 by a Standards-Track RFC to have a null reverse-path) SHOULD be sent 3370 with a valid, non-null reverse-path. 3372 Implementers of automated email processors should be careful to make 3373 sure that the various kinds of messages with a null reverse-path are 3374 handled correctly. In particular, such systems SHOULD NOT reply to 3375 messages with a null reverse-path, and they SHOULD NOT add a non-null 3376 reverse-path, or change a null reverse-path to a non-null one, to 3377 such messages when forwarding. 3379 5. Address Resolution and Mail Handling 3381 5.1. Locating the Target Host 3383 Once an SMTP client lexically identifies a domain to which mail will 3384 be delivered for processing (as described in Sections 2.3.5 and 3.6), 3385 a DNS lookup MUST be performed to resolve the domain name (RFC 1035 3386 [4]). The names are expected to be fully-qualified domain names 3387 (FQDNs): mechanisms for inferring FQDNs from partial names or local 3388 aliases are outside of this specification. Due to a history of 3389 problems, SMTP servers used for initial submission of messages SHOULD 3390 NOT make such inferences (Message Submission Servers [42] have 3391 somewhat more flexibility) and intermediate (relay) SMTP servers MUST 3392 NOT make them. 3394 The lookup first attempts to locate an MX record associated with the 3395 name. If a CNAME record is found, the resulting name is processed as 3396 if it were the initial name. If a non-existent domain error is 3397 returned, this situation MUST be reported as an error. If a 3398 temporary error is returned, the message MUST be queued and retried 3399 later (see Section 4.5.4.1). If an empty list of MXs is returned, 3400 the address is treated as if it was associated with an implicit MX 3401 RR, with a preference of 0, pointing to that host. If MX records are 3402 present, but none of them are usable, or the implicit MX is unusable, 3403 this situation MUST be reported as an error. 3405 If one or more MX RRs are found for a given name, SMTP systems MUST 3406 NOT utilize any address RRs associated with that name unless they are 3407 located using the MX RRs; the "implicit MX" rule above applies only 3408 if there are no MX records present. If MX records are present, but 3409 none of them are usable, this situation MUST be reported as an error. 3411 When a domain name associated with an MX RR is looked up and the 3412 associated data field obtained, the data field of that response MUST 3413 contain a domain name that conforms to the specifications of 3414 Section 2.3.5. 3415 [[5321bis Editor's Note: Depending on how the "null MX" discussion 3416 unfolds, some additional text may be in order here (20140718)]] 3417 That domain name, when queried, MUST return at least one address 3418 record (e.g., A or AAAA RR) that gives the IP address of the SMTP 3419 server to which the message should be directed. Any other response, 3420 specifically including a value that will return a CNAME record when 3421 queried, lies outside the scope of this Standard. The prohibition on 3422 labels in the data that resolve to CNAMEs is discussed in more detail 3423 in RFC 2181, Section 10.3 [27]. 3425 When the lookup succeeds, the mapping can result in a list of 3426 alternative delivery addresses rather than a single address, because 3427 of multiple MX records, multihoming, or both. To provide reliable 3428 mail transmission, the SMTP client MUST be able to try (and retry) 3429 each of the relevant addresses in this list in order, until a 3430 delivery attempt succeeds. However, there MAY also be a configurable 3431 limit on the number of alternate addresses that can be tried. In any 3432 case, the SMTP client SHOULD try at least two addresses. 3434 Two types of information are used to rank the host addresses: 3435 multiple MX records, and multihomed hosts. 3437 MX records contain a preference indication that MUST be used in 3438 sorting if more than one such record appears (see below). Lower 3439 numbers are more preferred than higher ones. If there are multiple 3440 destinations with the same preference and there is no clear reason to 3441 favor one (e.g., by recognition of an easily reached address), then 3442 the sender-SMTP MUST randomize them to spread the load across 3443 multiple mail exchangers for a specific organization. 3445 The destination host (perhaps taken from the preferred MX record) may 3446 be multihomed, in which case the domain name resolver will return a 3447 list of alternative IP addresses. It is the responsibility of the 3448 domain name resolver interface to have ordered this list by 3449 decreasing preference if necessary, and the SMTP sender MUST try them 3450 in the order presented. 3452 Although the capability to try multiple alternative addresses is 3453 required, specific installations may want to limit or disable the use 3454 of alternative addresses. The question of whether a sender should 3455 attempt retries using the different addresses of a multihomed host 3456 has been controversial. The main argument for using the multiple 3457 addresses is that it maximizes the probability of timely delivery, 3458 and indeed sometimes the probability of any delivery; the counter- 3459 argument is that it may result in unnecessary resource use. Note 3460 that resource use is also strongly determined by the sending strategy 3461 discussed in Section 4.5.4.1. 3463 If an SMTP server receives a message with a destination for which it 3464 is a designated Mail eXchanger, it MAY relay the message (potentially 3465 after having rewritten the MAIL FROM and/or RCPT TO addresses), make 3466 final delivery of the message, or hand it off using some mechanism 3467 outside the SMTP-provided transport environment. Of course, neither 3468 of the latter require that the list of MX records be examined 3469 further. 3471 If it determines that it should relay the message without rewriting 3472 the address, it MUST sort the MX records to determine candidates for 3473 delivery. The records are first ordered by preference, with the 3474 lowest-numbered records being most preferred. The relay host MUST 3475 then inspect the list for any of the names or addresses by which it 3476 might be known in mail transactions. If a matching record is found, 3477 all records at that preference level and higher-numbered ones MUST be 3478 discarded from consideration. If there are no records left at that 3479 point, it is an error condition, and the message MUST be returned as 3480 undeliverable. If records do remain, they SHOULD be tried, best 3481 preference first, as described above. 3483 5.2. IPv6 and MX Records 3485 In the contemporary Internet, SMTP clients and servers may be hosted 3486 on IPv4 systems, IPv6 systems, or dual-stack systems that are 3487 compatible with either version of the Internet Protocol. The host 3488 domains to which MX records point may, consequently, contain "A RR"s 3489 (IPv4), "AAAA RR"s (IPv6), or any combination of them. While RFC 3490 3974 [39] discusses some operational experience in mixed 3491 environments, it was not comprehensive enough to justify 3492 standardization, and some of its recommendations appear to be 3493 inconsistent with this specification. The appropriate actions to be 3494 taken either will depend on local circumstances, such as performance 3495 of the relevant networks and any conversions that might be necessary, 3496 or will be obvious (e.g., an IPv6-only client need not attempt to 3497 look up A RRs or attempt to reach IPv4-only servers). Designers of 3498 SMTP implementations that might run in IPv6 or dual-stack 3499 environments should study the procedures above, especially the 3500 comments about multihomed hosts, and, preferably, provide mechanisms 3501 to facilitate operational tuning and mail interoperability between 3502 IPv4 and IPv6 systems while considering local circumstances. 3504 6. Problem Detection and Handling 3506 6.1. Reliable Delivery and Replies by Email 3508 When the receiver-SMTP accepts a piece of mail (by sending a "250 OK" 3509 message in response to DATA), it is accepting responsibility for 3510 delivering or relaying the message. It must take this responsibility 3511 seriously. It MUST NOT lose the message for frivolous reasons, such 3512 as because the host later crashes or because of a predictable 3513 resource shortage. Some reasons that are not considered frivolous 3514 are discussed in the next subsection and in Section 7.8. 3516 If there is a delivery failure after acceptance of a message, the 3517 receiver-SMTP MUST formulate and mail a notification message. This 3518 notification MUST be sent using a null ("<>") reverse-path in the 3519 envelope. The recipient of this notification MUST be the address 3520 from the envelope return path (or the Return-Path: line). However, 3521 if this address is null ("<>"), the receiver-SMTP MUST NOT send a 3522 notification. Obviously, nothing in this section can or should 3523 prohibit local decisions (i.e., as part of the same system 3524 environment as the receiver-SMTP) to log or otherwise transmit 3525 information about null address events locally if that is desired. If 3526 the address is an explicit source route, it MUST be stripped down to 3527 its final hop. 3529 For example, suppose that an error notification must be sent for a 3530 message that arrived with: 3532 MAIL FROM:<@a,@b:user@d> 3534 The notification message MUST be sent using: 3536 RCPT TO: 3538 Some delivery failures after the message is accepted by SMTP will be 3539 unavoidable. For example, it may be impossible for the receiving 3540 SMTP server to validate all the delivery addresses in RCPT command(s) 3541 due to a "soft" domain system error, because the target is a mailing 3542 list (see earlier discussion of RCPT), or because the server is 3543 acting as a relay and has no immediate access to the delivering 3544 system. 3546 To avoid receiving duplicate messages as the result of timeouts, a 3547 receiver-SMTP MUST seek to minimize the time required to respond to 3548 the final . end of data indicator. See RFC 1047 [16] for 3549 a discussion of this problem. 3551 6.2. Unwanted, Unsolicited, and "Attack" Messages 3553 Utility and predictability of the Internet mail system requires that 3554 messages that can be delivered should be delivered, regardless of any 3555 syntax or other faults associated with those messages and regardless 3556 of their content. If they cannot be delivered, and cannot be 3557 rejected by the SMTP server during the SMTP transaction, they should 3558 be "bounced" (returned with non-delivery notification messages) as 3559 described above. In today's world, in which many SMTP server 3560 operators have discovered that the quantity of undesirable bulk email 3561 vastly exceeds the quantity of desired mail and in which accepting a 3562 message may trigger additional undesirable traffic by providing 3563 verification of the address, those principles may not be practical. 3565 As discussed in Section 7.8 and Section 7.9 below, dropping mail 3566 without notification of the sender is permitted in practice. 3567 However, it is extremely dangerous and violates a long tradition and 3568 community expectations that mail is either delivered or returned. If 3569 silent message-dropping is misused, it could easily undermine 3570 confidence in the reliability of the Internet's mail systems. So 3571 silent dropping of messages should be considered only in those cases 3572 where there is very high confidence that the messages are seriously 3573 fraudulent or otherwise inappropriate. 3575 To stretch the principle of delivery if possible even further, it may 3576 be a rational policy to not deliver mail that has an invalid return 3577 address, although the history of the network is that users are 3578 typically better served by delivering any message that can be 3579 delivered. Reliably determining that a return address is invalid can 3580 be a difficult and time-consuming process, especially if the putative 3581 sending system is not directly accessible or does not fully and 3582 accurately support VRFY and, even if a "drop messages with invalid 3583 return addresses" policy is adopted, it SHOULD be applied only when 3584 there is near-certainty that the return addresses are, in fact, 3585 invalid. 3587 Conversely, if a message is rejected because it is found to contain 3588 hostile content (a decision that is outside the scope of an SMTP 3589 server as defined in this document), rejection ("bounce") messages 3590 SHOULD NOT be sent unless the receiving site is confident that those 3591 messages will be usefully delivered. The preference and default in 3592 these cases is to avoid sending non-delivery messages when the 3593 incoming message is determined to contain hostile content. 3595 6.3. Loop Detection 3597 Simple counting of the number of "Received:" header fields in a 3598 message has proven to be an effective, although rarely optimal, 3599 method of detecting loops in mail systems. SMTP servers using this 3600 technique SHOULD use a large rejection threshold, normally at least 3601 100 Received entries. Whatever mechanisms are used, servers MUST 3602 contain provisions for detecting and stopping trivial loops. 3604 6.4. Compensating for Irregularities 3606 Unfortunately, variations, creative interpretations, and outright 3607 violations of Internet mail protocols do occur; some would suggest 3608 that they occur quite frequently. The debate as to whether a well- 3609 behaved SMTP receiver or relay should reject a malformed message, 3610 attempt to pass it on unchanged, or attempt to repair it to increase 3611 the odds of successful delivery (or subsequent reply) began almost 3612 with the dawn of structured network mail and shows no signs of 3613 abating. Advocates of rejection claim that attempted repairs are 3614 rarely completely adequate and that rejection of bad messages is the 3615 only way to get the offending software repaired. Advocates of 3616 "repair" or "deliver no matter what" argue that users prefer that 3617 mail go through it if at all possible and that there are significant 3618 market pressures in that direction. In practice, these market 3619 pressures may be more important to particular vendors than strict 3620 conformance to the standards, regardless of the preference of the 3621 actual developers. 3623 The problems associated with ill-formed messages were exacerbated by 3624 the introduction of the split-UA mail reading protocols (Post Office 3625 Protocol (POP) version 2 [13], Post Office Protocol (POP) version 3 3626 [22], IMAP version 2 [18], and PCMAIL [17]). These protocols 3627 encouraged the use of SMTP as a posting (message submission) 3628 protocol, and SMTP servers as relay systems for these client hosts 3629 (which are often only intermittently connected to the Internet). 3630 Historically, many of those client machines lacked some of the 3631 mechanisms and information assumed by SMTP (and indeed, by the mail 3632 format protocol, RFC 822 [12]). Some could not keep adequate track 3633 of time; others had no concept of time zones; still others could not 3634 identify their own names or addresses; and, of course, none could 3635 satisfy the assumptions that underlay RFC 822's conception of 3636 authenticated addresses. 3638 In response to these weak SMTP clients, many SMTP systems now 3639 complete messages that are delivered to them in incomplete or 3640 incorrect form. This strategy is generally considered appropriate 3641 when the server can identify or authenticate the client, and there 3642 are prior agreements between them. By contrast, there is at best 3643 great concern about fixes applied by a relay or delivery SMTP server 3644 that has little or no knowledge of the user or client machine. Many 3645 of these issues are addressed by using a separate protocol, such as 3646 that defined in RFC 6409 [42], for message submission, rather than 3647 using originating SMTP servers for that purpose. 3649 The following changes to a message being processed MAY be applied 3650 when necessary by an originating SMTP server, or one used as the 3651 target of SMTP as an initial posting (message submission) protocol: 3653 o Addition of a message-id field when none appears 3655 o Addition of a date, time, or time zone when none appears 3657 o Correction of addresses to proper FQDN format 3659 The less information the server has about the client, the less likely 3660 these changes are to be correct and the more caution and conservatism 3661 should be applied when considering whether or not to perform fixes 3662 and how. These changes MUST NOT be applied by an SMTP server that 3663 provides an intermediate relay function. 3665 In all cases, properly operating clients supplying correct 3666 information are preferred to corrections by the SMTP server. In all 3667 cases, documentation SHOULD be provided in trace header fields and/or 3668 header field comments for actions performed by the servers. 3670 7. Security Considerations 3672 7.1. Mail Security and Spoofing 3674 SMTP mail is inherently insecure in that it is feasible for even 3675 fairly casual users to negotiate directly with receiving and relaying 3676 SMTP servers and create messages that will trick a naive recipient 3677 into believing that they came from somewhere else. Constructing such 3678 a message so that the "spoofed" behavior cannot be detected by an 3679 expert is somewhat more difficult, but not sufficiently so as to be a 3680 deterrent to someone who is determined and knowledgeable. 3681 Consequently, as knowledge of Internet mail increases, so does the 3682 knowledge that SMTP mail inherently cannot be authenticated, or 3683 integrity checks provided, at the transport level. Real mail 3684 security lies only in end-to-end methods involving the message 3685 bodies, such as those that use digital signatures (see RFC 1847 [20] 3686 and, e.g., Pretty Good Privacy (PGP) in RFC 4880 [45] or Secure/ 3687 Multipurpose Internet Mail Extensions (S/MIME) in RFC 8551 [38]). 3689 Various protocol extensions and configuration options that provide 3690 authentication at the transport level (e.g., from an SMTP client to 3691 an SMTP server) improve somewhat on the traditional situation 3692 described above. However, in general, they only authenticate one 3693 server to another rather than a chain of relays and servers, much 3694 less authenticating users or user machines. Consequently, unless 3695 they are accompanied by careful handoffs of responsibility in a 3696 carefully designed trust environment, they remain inherently weaker 3697 than end-to-end mechanisms that use digitally signed messages rather 3698 than depending on the integrity of the transport system. 3700 Efforts to make it more difficult for users to set envelope return 3701 path and header "From" fields to point to valid addresses other than 3702 their own are largely misguided: they frustrate legitimate 3703 applications in which mail is sent by one user on behalf of another, 3704 in which error (or normal) replies should be directed to a special 3705 address, or in which a single message is sent to multiple recipients 3706 on different hosts. (Systems that provide convenient ways for users 3707 to alter these header fields on a per-message basis should attempt to 3708 establish a primary and permanent mailbox address for the user so 3709 that Sender header fields within the message data can be generated 3710 sensibly.) 3712 This specification does not further address the authentication issues 3713 associated with SMTP other than to advocate that useful functionality 3714 not be disabled in the hope of providing some small margin of 3715 protection against a user who is trying to fake mail. 3717 7.2. "Blind" Copies 3719 Addresses that do not appear in the message header section may appear 3720 in the RCPT commands to an SMTP server for a number of reasons. The 3721 two most common involve the use of a mailing address as a "list 3722 exploder" (a single address that resolves into multiple addresses) 3723 and the appearance of "blind copies". Especially when more than one 3724 RCPT command is present, and in order to avoid defeating some of the 3725 purpose of these mechanisms, SMTP clients and servers SHOULD NOT copy 3726 the full set of RCPT command arguments into the header section, 3727 either as part of trace header fields or as informational or private- 3728 extension header fields. [[CREF23: [rfc5321bis] [[Note in draft - 3729 Suggestion from 20070124 that got lost: delete "especially" and "the 3730 full set of" -- copying the first one can be as harmful as copying 3731 all of them, at least without verifying that the addresses do appear 3732 in the headers.]] Arnt Gulbrandsen, arnt@oryx.com, 2007.01.24 3733 1121+0100]] Since this rule is often violated in practice, and cannot 3734 be enforced, sending SMTP systems that are aware of "bcc" use MAY 3735 find it helpful to send each blind copy as a separate message 3736 transaction containing only a single RCPT command. 3738 There is no inherent relationship between either "reverse" (from the 3739 MAIL command) or "forward" (RCPT) addresses in the SMTP transaction 3740 ("envelope") and the addresses in the header section. Receiving 3741 systems SHOULD NOT attempt to deduce such relationships and use them 3742 to alter the header section of the message for delivery. The popular 3743 "Apparently-to" header field is a violation of this principle as well 3744 as a common source of unintended information disclosure and SHOULD 3745 NOT be used. 3747 7.3. VRFY, EXPN, and Security 3749 As discussed in Section 3.5, individual sites may want to disable 3750 either or both of VRFY or EXPN for security reasons (see below). As 3751 a corollary to the above, implementations that permit this MUST NOT 3752 appear to have verified addresses that are not, in fact, verified. 3753 If a site disables these commands for security reasons, the SMTP 3754 server MUST return a 252 response, rather than a code that could be 3755 confused with successful or unsuccessful verification. 3757 Returning a 250 reply code with the address listed in the VRFY 3758 command after having checked it only for syntax violates this rule. 3759 Of course, an implementation that "supports" VRFY by always returning 3760 550 whether or not the address is valid is equally not in 3761 conformance. 3763 On the public Internet, the contents of mailing lists have become 3764 popular as an address information source for so-called "spammers." 3765 The use of EXPN to "harvest" addresses has increased as list 3766 administrators have installed protections against inappropriate uses 3767 of the lists themselves. However, VRFY and EXPN are still useful for 3768 authenticated users and within an administrative domain. For 3769 example, VRFY and EXPN are useful for performing internal audits of 3770 how email gets routed to check and to make sure no one is 3771 automatically forwarding sensitive mail outside the organization. 3772 Sites implementing SMTP authentication may choose to make VRFY and 3773 EXPN available only to authenticated requestors. Implementations 3774 SHOULD still provide support for EXPN, but sites SHOULD carefully 3775 evaluate the tradeoffs. 3777 Whether disabling VRFY provides any real marginal security depends on 3778 a series of other conditions. In many cases, RCPT commands can be 3779 used to obtain the same information about address validity. On the 3780 other hand, especially in situations where determination of address 3781 validity for RCPT commands is deferred until after the DATA command 3782 is received, RCPT may return no information at all, while VRFY is 3783 expected to make a serious attempt to determine validity before 3784 generating a response code (see discussion above). 3786 7.4. Mail Rerouting Based on the 251 and 551 Response Codes 3788 Before a client uses the 251 or 551 reply codes from a RCPT command 3789 to automatically update its future behavior (e.g., updating the 3790 user's address book), it should be certain of the server's 3791 authenticity. If it does not, it may be subject to a man in the 3792 middle attack. 3794 7.5. Information Disclosure in Announcements 3796 There has been an ongoing debate about the tradeoffs between the 3797 debugging advantages of announcing server type and version (and, 3798 sometimes, even server domain name) in the greeting response or in 3799 response to the HELP command and the disadvantages of exposing 3800 information that might be useful in a potential hostile attack. The 3801 utility of the debugging information is beyond doubt. Those who 3802 argue for making it available point out that it is far better to 3803 actually secure an SMTP server rather than hope that trying to 3804 conceal known vulnerabilities by hiding the server's precise identity 3805 will provide more protection. Sites are encouraged to evaluate the 3806 tradeoff with that issue in mind; implementations SHOULD minimally 3807 provide for making type and version information available in some way 3808 to other network hosts. 3810 7.6. Information Disclosure in Trace Fields 3812 In some circumstances, such as when mail originates from within a LAN 3813 whose hosts are not directly on the public Internet, trace 3814 ("Received") header fields produced in conformance with this 3815 specification may disclose host names and similar information that 3816 would not normally be available. This ordinarily does not pose a 3817 problem, but sites with special concerns about name disclosure should 3818 be aware of it. Also, the optional FOR clause should be supplied 3819 with caution or not at all when multiple recipients are involved lest 3820 it inadvertently disclose the identities of "blind copy" recipients 3821 to others. 3823 7.7. Information Disclosure in Message Forwarding 3825 As discussed in Section 3.4, use of the 251 or 551 reply codes to 3826 identify the replacement address associated with a mailbox may 3827 inadvertently disclose sensitive information. Sites that are 3828 concerned about those issues should ensure that they select and 3829 configure servers appropriately. 3831 7.8. Resistance to Attacks 3833 In recent years, there has been an increase of attacks on SMTP 3834 servers, either in conjunction with attempts to discover addresses 3835 for sending unsolicited messages or simply to make the servers 3836 inaccessible to others (i.e., as an application-level denial of 3837 service attack). While the means of doing so are beyond the scope of 3838 this Standard, rational operational behavior requires that servers be 3839 permitted to detect such attacks and take action to defend 3840 themselves. For example, if a server determines that a large number 3841 of RCPT TO commands are being sent, most or all with invalid 3842 addresses, as part of such an attack, it would be reasonable for the 3843 server to close the connection after generating an appropriate number 3844 of 5yz (normally 550) replies. 3846 7.9. Scope of Operation of SMTP Servers 3848 It is a well-established principle that an SMTP server may refuse to 3849 accept mail for any operational or technical reason that makes sense 3850 to the site providing the server. However, cooperation among sites 3851 and installations makes the Internet possible. If sites take 3852 excessive advantage of the right to reject traffic, the ubiquity of 3853 email availability (one of the strengths of the Internet) will be 3854 threatened; considerable care should be taken and balance maintained 3855 if a site decides to be selective about the traffic it will accept 3856 and process. 3858 In recent years, use of the relay function through arbitrary sites 3859 has been used as part of hostile efforts to hide the actual origins 3860 of mail. Some sites have decided to limit the use of the relay 3861 function to known or identifiable sources, and implementations SHOULD 3862 provide the capability to perform this type of filtering. When mail 3863 is rejected for these or other policy reasons, a 550 code SHOULD be 3864 used in response to EHLO (or HELO), MAIL, or RCPT as appropriate. 3866 8. IANA Considerations 3868 IANA maintains three registries in support of this specification, all 3869 of which were created for RFC 2821 or earlier. This document expands 3870 the third one as specified below. The registry references listed are 3871 as of the time of publication; IANA does not guarantee the locations 3872 associated with the URLs. The registries are as follows: 3874 o The first, "Simple Mail Transfer Protocol (SMTP) Service 3875 Extensions" [49], consists of SMTP service extensions with the 3876 associated keywords, and, as needed, parameters and verbs. As 3877 specified in Section 2.2.2, no entry may be made in this registry 3878 that starts in an "X". Entries may be made only for service 3879 extensions (and associated keywords, parameters, or verbs) that 3880 are defined in Standards-Track or Experimental RFCs specifically 3881 approved by the IESG for this purpose. 3883 o The second registry, "Address Literal Tags" [50], consists of 3884 "tags" that identify forms of domain literals other than those for 3885 IPv4 addresses (specified in RFC 821 and in this document). The 3886 initial entry in that registry is for IPv6 addresses (specified in 3887 this document). Additional literal types require standardization 3888 before being used; none are anticipated at this time. 3890 o The third, "Mail Transmission Types" [49], established by RFC 821 3891 and renewed by this specification, is a registry of link and 3892 protocol identifiers to be used with the "via" and "with" 3893 subclauses of the time stamp ("Received:" header field) described 3894 in Section 4.4. Link and protocol identifiers in addition to 3895 those specified in this document may be registered only by 3896 standardization or by way of an RFC-documented, IESG-approved, 3897 Experimental protocol extension. This name space is for 3898 identification and not limited in size: the IESG is encouraged to 3899 approve on the basis of clear documentation and a distinct method 3900 rather than preferences about the properties of the method itself. 3902 An additional subsection has been added to the "VIA link types" 3903 and "WITH protocol types" subsections of this registry to contain 3904 registrations of "Additional-registered-clauses" as described 3905 above. The registry will contain clause names, a description, a 3906 summary of the syntax of the associated String, and a reference. 3907 As new clauses are defined, they may, in principle, specify 3908 creation of their own registries if the Strings consist of 3909 reserved terms or keywords rather than less restricted strings. 3910 As with link and protocol identifiers, additional clauses may be 3911 registered only by standardization or by way of an RFC-documented, 3912 IESG-approved, Experimental protocol extension. The additional 3913 clause name space is for identification and is not limited in 3914 size: the IESG is encouraged to approve on the basis of clear 3915 documentation, actual use or strong signs that the clause will be 3916 used, and a distinct requirement rather than preferences about the 3917 properties of the clause itself. 3919 In addition, if additional trace header fields (i.e., in addition to 3920 Return-path and Received) are ever created, those trace fields MUST 3921 be added to the IANA registry established by BCP 90 (RFC 3864) [8] 3922 for use with RFC 5322 [11]. 3924 9. Acknowledgments 3926 Many people contributed to the development of RFCs 2821 and 5321. 3927 Those documents should be consulted for those acknowledgments. 3929 Neither this document nor RFCs 2821 or 5321 would have been possible 3930 without the many contribution and insights of the late Jon Postel. 3931 Those contributions of course include the original specification of 3932 SMTP in RFC 821. A considerable quantity of text from RFC 821 still 3933 appears in this document as do several of Jon's original examples 3934 that have been updated only as needed to reflect other changes in the 3935 specification. 3937 The following filed errata against RFC 5321 that were not rejected at 3938 the time of submission: Jasen Betts, Adrien de Croy Guillaume Fortin- 3939 Debigare Roberto Javier Godoy, David Romerstein, Dominic Sayers, 3940 Rodrigo Speller, Alessandro Vesely, and Brett Watson. In addition, 3941 specific suggestions that led to corrections and improvements in 3942 early versions of the current specification were received from Ned 3943 Freed, Barry Leiba, Ivar Lumi, Pete Resnick, Hector Santos, Paul 3944 Smith and others. 3946 chetti contributed an analysis that clarified the ABNF productions 3947 that implicitly reference other documents. 3949 [[CREF24: Some errata and comments after 2019-07-01 have not yet been 3950 captured in this version of the draft. ]] 3952 The EMAILCORE Working Group was chartered in September 2020 with 3953 Alexey Melnikov and Seth Blank and co-chairs. Without their 3954 leadership and technical contributions, this document would never 3955 have been completed. 3957 10. References 3959 10.1. Normative References 3961 [1] Bradner, S., "Key words for use in RFCs to Indicate 3962 Requirement Levels", BCP 14, RFC 2119, 3963 DOI 10.17487/RFC2119, March 1997, 3964 . 3966 [2] American National Standards Institute (formerly United 3967 States of America Standards Institute), "USA Code for 3968 Information Interchange", ANSI X3.4-1968, 1968. 3970 ANSI X3.4-1968 has been replaced by newer versions with 3971 slight modifications, but the 1968 version remains 3972 definitive for the Internet. 3974 [3] Postel, J., "Simple Mail Transfer Protocol", STD 10, 3975 RFC 821, DOI 10.17487/RFC0821, August 1982, 3976 . 3978 [4] Mockapetris, P., "Domain names - implementation and 3979 specification", STD 13, RFC 1035, DOI 10.17487/RFC1035, 3980 November 1987, . 3982 [5] Braden, R., Ed., "Requirements for Internet Hosts - 3983 Application and Support", STD 3, RFC 1123, 3984 DOI 10.17487/RFC1123, October 1989, 3985 . 3987 [6] Klensin, J., Freed, N., and K. Moore, "SMTP Service 3988 Extension for Message Size Declaration", STD 10, RFC 1870, 3989 DOI 10.17487/RFC1870, November 1995, 3990 . 3992 [7] Newman, C., "ESMTP and LMTP Transmission Types 3993 Registration", RFC 3848, DOI 10.17487/RFC3848, July 2004, 3994 . 3996 [8] Klyne, G., Nottingham, M., and J. Mogul, "Registration 3997 Procedures for Message Header Fields", BCP 90, RFC 3864, 3998 DOI 10.17487/RFC3864, September 2004, 3999 . 4001 [9] Hinden, R. and S. Deering, "IP Version 6 Addressing 4002 Architecture", RFC 4291, DOI 10.17487/RFC4291, February 4003 2006, . 4005 [10] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax 4006 Specifications: ABNF", STD 68, RFC 5234, 4007 DOI 10.17487/RFC5234, January 2008, 4008 . 4010 [11] Resnick, P., "Internet Message Format", RFC 5322, 4011 September 2008. 4013 10.2. Informative References 4015 [12] Crocker, D., "STANDARD FOR THE FORMAT OF ARPA INTERNET 4016 TEXT MESSAGES", STD 11, RFC 822, DOI 10.17487/RFC0822, 4017 August 1982, . 4019 [13] Butler, M., Postel, J., Chase, D., Goldberger, J., and J. 4020 Reynolds, "Post Office Protocol: Version 2", RFC 937, 4021 DOI 10.17487/RFC0937, February 1985, 4022 . 4024 [14] Postel, J. and J. Reynolds, "File Transfer Protocol", 4025 STD 9, RFC 959, DOI 10.17487/RFC0959, October 1985, 4026 . 4028 [15] Partridge, C., "Mail routing and the domain system", 4029 STD 10, RFC 974, DOI 10.17487/RFC0974, January 1986, 4030 . 4032 [16] Partridge, C., "Duplicate messages and SMTP", RFC 1047, 4033 DOI 10.17487/RFC1047, February 1988, 4034 . 4036 [17] Lambert, M., "PCMAIL: A distributed mail system for 4037 personal computers", RFC 1056, DOI 10.17487/RFC1056, June 4038 1988, . 4040 [18] Crispin, M., "Interactive Mail Access Protocol: Version 4041 2", RFC 1176, DOI 10.17487/RFC1176, August 1990, 4042 . 4044 [19] Durand, A. and F. Dupont, "SMTP 521 Reply Code", RFC 1846, 4045 DOI 10.17487/RFC1846, September 1995, 4046 . 4048 [20] Galvin, J., Murphy, S., Crocker, S., and N. Freed, 4049 "Security Multiparts for MIME: Multipart/Signed and 4050 Multipart/Encrypted", RFC 1847, DOI 10.17487/RFC1847, 4051 October 1995, . 4053 [21] Klensin, J., Freed, N., Rose, M., Stefferud, E., and D. 4054 Crocker, "SMTP Service Extensions", STD 10, RFC 1869, 4055 DOI 10.17487/RFC1869, November 1995, 4056 . 4058 [22] Myers, J. and M. Rose, "Post Office Protocol - Version 3", 4059 STD 53, RFC 1939, DOI 10.17487/RFC1939, May 1996, 4060 . 4062 [23] De Winter, J., "SMTP Service Extension for Remote Message 4063 Queue Starting", RFC 1985, DOI 10.17487/RFC1985, August 4064 1996, . 4066 [24] Freed, N. and N. Borenstein, "Multipurpose Internet Mail 4067 Extensions (MIME) Part One: Format of Internet Message 4068 Bodies", RFC 2045, DOI 10.17487/RFC2045, November 1996, 4069 . 4071 [25] Moore, K., "MIME (Multipurpose Internet Mail Extensions) 4072 Part Three: Message Header Extensions for Non-ASCII Text", 4073 RFC 2047, DOI 10.17487/RFC2047, November 1996, 4074 . 4076 [26] Kille, S., "MIXER (Mime Internet X.400 Enhanced Relay): 4077 Mapping between X.400 and RFC 822/MIME", RFC 2156, 4078 DOI 10.17487/RFC2156, January 1998, 4079 . 4081 [27] Elz, R. and R. Bush, "Clarifications to the DNS 4082 Specification", RFC 2181, DOI 10.17487/RFC2181, July 1997, 4083 . 4085 [28] Freed, N. and K. Moore, "MIME Parameter Value and Encoded 4086 Word Extensions: Character Sets, Languages, and 4087 Continuations", RFC 2231, DOI 10.17487/RFC2231, November 4088 1997, . 4090 [29] Klensin, J., Ed., "Simple Mail Transfer Protocol", 4091 RFC 2821, DOI 10.17487/RFC2821, April 2001, 4092 . 4094 [30] Freed, N., "SMTP Service Extension for Command 4095 Pipelining", STD 60, RFC 2920, DOI 10.17487/RFC2920, 4096 September 2000, . 4098 [31] Freed, N., "Behavior of and Requirements for Internet 4099 Firewalls", RFC 2979, DOI 10.17487/RFC2979, October 2000, 4100 . 4102 [32] Vaudreuil, G., "SMTP Service Extensions for Transmission 4103 of Large and Binary MIME Messages", RFC 3030, 4104 DOI 10.17487/RFC3030, December 2000, 4105 . 4107 [33] Moore, K., "Simple Mail Transfer Protocol (SMTP) Service 4108 Extension for Delivery Status Notifications (DSNs)", 4109 RFC 3461, DOI 10.17487/RFC3461, January 2003, 4110 . 4112 [34] Vaudreuil, G., "Enhanced Mail System Status Codes", 4113 RFC 3463, DOI 10.17487/RFC3463, January 2003, 4114 . 4116 [35] Moore, K. and G. Vaudreuil, "An Extensible Message Format 4117 for Delivery Status Notifications", RFC 3464, 4118 DOI 10.17487/RFC3464, January 2003, 4119 . 4121 [36] Crispin, M., "INTERNET MESSAGE ACCESS PROTOCOL - VERSION 4122 4rev1", RFC 3501, DOI 10.17487/RFC3501, March 2003, 4123 . 4125 [37] Hansen, T., Ed. and A. Melnikov, Ed., "Message Disposition 4126 Notification", STD 85, RFC 8098, DOI 10.17487/RFC8098, 4127 February 2017, . 4129 [38] Schaad, J., Ramsdell, B., and S. Turner, "Secure/ 4130 Multipurpose Internet Mail Extensions (S/MIME) Version 4.0 4131 Message Specification", RFC 8551, DOI 10.17487/RFC8551, 4132 April 2019, . 4134 [39] Nakamura, M. and J. Hagino, "SMTP Operational Experience 4135 in Mixed IPv4/v6 Environments", RFC 3974, 4136 DOI 10.17487/RFC3974, January 2005, 4137 . 4139 [40] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 4140 Resource Identifier (URI): Generic Syntax", STD 66, 4141 RFC 3986, DOI 10.17487/RFC3986, January 2005, 4142 . 4144 [41] Kitterman, S., "Sender Policy Framework (SPF) for 4145 Authorizing Use of Domains in Email, Version 1", RFC 7208, 4146 DOI 10.17487/RFC7208, April 2014, 4147 . 4149 [42] Gellens, R. and J. Klensin, "Message Submission for Mail", 4150 STD 72, RFC 6409, DOI 10.17487/RFC6409, November 2011, 4151 . 4153 [43] Fenton, J., "Analysis of Threats Motivating DomainKeys 4154 Identified Mail (DKIM)", RFC 4686, DOI 10.17487/RFC4686, 4155 September 2006, . 4157 [44] Crocker, D., Ed., Hansen, T., Ed., and M. Kucherawy, Ed., 4158 "DomainKeys Identified Mail (DKIM) Signatures", STD 76, 4159 RFC 6376, DOI 10.17487/RFC6376, September 2011, 4160 . 4162 [45] Callas, J., Donnerhacke, L., Finney, H., Shaw, D., and R. 4163 Thayer, "OpenPGP Message Format", RFC 4880, 4164 DOI 10.17487/RFC4880, November 2007, 4165 . 4167 [46] Hansen, T. and J. Klensin, "A Registry for SMTP Enhanced 4168 Mail System Status Codes", BCP 138, RFC 5248, 4169 DOI 10.17487/RFC5248, June 2008, 4170 . 4172 [47] Klensin, J., Freed, N., Rose, M., and D. Crocker, Ed., 4173 "SMTP Service Extension for 8-bit MIME Transport", STD 71, 4174 RFC 6152, DOI 10.17487/RFC6152, March 2011, 4175 . 4177 [48] Klensin, J., "SMTP 521 and 556 Reply Codes", RFC 7504, 4178 DOI 10.17487/RFC7504, June 2015, 4179 . 4181 [49] Internet Assigned Number Authority (IANA), "IANA Mail 4182 Parameters", 2007, 4183 . 4185 [50] Internet Assigned Number Authority (IANA), "Address 4186 Literal Tags", 2007, 4187 . 4189 [51] Levine, J. and M. Delany, "A "Null MX" No Service Resource 4190 Record for Domains that Accept No Mail", September 2014, 4191 . 4194 [52] RFC Editor, "RFC Errata - RFC 5321", 2019, 4195 . 4197 Captured 2019-11-19 4199 Appendix A. TCP Transport Service 4201 The TCP connection supports the transmission of 8-bit bytes. The 4202 SMTP data is 7-bit ASCII characters. Each character is transmitted 4203 as an 8-bit byte with the high-order bit cleared to zero. Service 4204 extensions may modify this rule to permit transmission of full 8-bit 4205 data bytes as part of the message body, or, if specifically designed 4206 to do so, in SMTP commands or responses. 4208 Appendix B. Generating SMTP Commands from RFC 822 Header Fields 4210 Some systems use an RFC 822 header section (only) in a mail 4211 submission protocol, or otherwise generate SMTP commands from RFC 822 4212 header fields when such a message is handed to an MTA from a UA. 4213 While the MTA-UA protocol is a private matter, not covered by any 4214 Internet Standard, there are problems with this approach. For 4215 example, there have been repeated problems with proper handling of 4216 "bcc" copies and redistribution lists when information that 4217 conceptually belongs to the mail envelope is not separated early in 4218 processing from header field information (and kept separate). 4220 It is recommended that the UA provide its initial ("submission 4221 client") MTA with an envelope separate from the message itself. 4222 However, if the envelope is not supplied, SMTP commands SHOULD be 4223 generated as follows: 4225 1. Each recipient address from a TO, CC, or BCC header field SHOULD 4226 be copied to a RCPT command (generating multiple message copies 4227 if that is required for queuing or delivery). This includes any 4228 addresses listed in a RFC 822 "group". Any BCC header fields 4229 SHOULD then be removed from the header section. Once this 4230 process is completed, the remaining header fields SHOULD be 4231 checked to verify that at least one TO, CC, or BCC header field 4232 remains. If none do, then a BCC header field with no additional 4233 information SHOULD be inserted as specified in [11]. 4235 2. The return address in the MAIL command SHOULD, if possible, be 4236 derived from the system's identity for the submitting (local) 4237 user, and the "From:" header field otherwise. If there is a 4238 system identity available, it SHOULD also be copied to the Sender 4239 header field if it is different from the address in the From 4240 header field. (Any Sender header field that was already there 4241 SHOULD be removed.) Systems may provide a way for submitters to 4242 override the envelope return address, but may want to restrict 4243 its use to privileged users. This will not prevent mail forgery, 4244 but may lessen its incidence; see Section 7.1. 4246 When an MTA is being used in this way, it bears responsibility for 4247 ensuring that the message being transmitted is valid. The mechanisms 4248 for checking that validity, and for handling (or returning) messages 4249 that are not valid at the time of arrival, are part of the MUA-MTA 4250 interface and not covered by this specification. 4252 A submission protocol based on Standard RFC 822 information alone 4253 MUST NOT be used to gateway a message from a foreign (non-SMTP) mail 4254 system into an SMTP environment. Additional information to construct 4255 an envelope must come from some source in the other environment, 4256 whether supplemental header fields or the foreign system's envelope. 4258 Attempts to gateway messages using only their header "To" and "Cc" 4259 fields have repeatedly caused mail loops and other behavior adverse 4260 to the proper functioning of the Internet mail environment. These 4261 problems have been especially common when the message originates from 4262 an Internet mailing list and is distributed into the foreign 4263 environment using envelope information. When these messages are then 4264 processed by a header-section-only remailer, loops back to the 4265 Internet environment (and the mailing list) are almost inevitable. 4267 Appendix C. Source Routes 4269 Historically, the was a reverse source routing list of 4270 hosts and a source mailbox. The first host in the was 4271 historically the host sending the MAIL command; today, source routes 4272 SHOULD NOT appear in the reverse-path. Similarly, the 4273 may be a source routing lists of hosts and a destination mailbox. 4274 However, in general, the SHOULD contain only a mailbox 4275 and domain name, relying on the domain name system to supply routing 4276 information if required. The use of source routes is deprecated (see 4277 Appendix F.2); while servers MUST be prepared to receive and handle 4278 them as discussed in Section 3.3 and Appendix F.2, clients SHOULD NOT 4279 transmit them and this section is included in the current 4280 specification only to provide context. It has been modified somewhat 4281 from the material in RFC 821 to prevent server actions that might 4282 confuse clients or subsequent servers that do not expect a full 4283 source route implementation. 4285 Historically, for relay purposes, the forward-path may have been a 4286 source route of the form "@ONE,@TWO:JOE@THREE", where ONE, TWO, and 4287 THREE MUST be fully-qualified domain names. This form was used to 4288 emphasize the distinction between an address and a route. The 4289 mailbox (here, JOE@THREE) is an absolute address, and the route is 4290 information about how to get there. The two concepts should not be 4291 confused. [[CREF25: [5321bis]JcK 20090123: Tightened this and the 4292 next paragraph to be clear that this doesn't authorize source route 4293 use.]] 4294 If source routes are used contrary to requirements and 4295 recommendations elsewhere in this specfiication, RFC 821 and the text 4296 below should be consulted for the mechanisms for constructing and 4297 updating the forward-path. A server that is reached by means of a 4298 source route (e.g., its domain name appears first in the list in the 4299 forward-path) MUST remove its domain name from any forward-paths in 4300 which that domain name appears before forwarding the message and MAY 4301 remove all other source routing information. The reverse-path SHOULD 4302 NOT be updated by servers conforming to this specification. 4304 Notice that the forward-path and reverse-path appear in the SMTP 4305 commands and replies, but not necessarily in the message. That is, 4306 there is no need for these paths and especially this syntax to appear 4307 in the "To:" , "From:", "CC:", etc. fields of the message header 4308 section. Conversely, SMTP servers MUST NOT derive final message 4309 routing information from message header fields. 4311 When the list of hosts is present despite the recommendations and 4312 requirements [[CREF26: [5321bis]JcK 20090123 "and requrements" 4313 added]] above, it is a "reverse" source route and indicates that the 4314 mail was relayed through each host on the list (the first host in the 4315 list was the most recent relay). This list is used as a source route 4316 to return non-delivery notices to the sender. If, contrary to the 4317 recommendations here, a relay host adds itself to the beginning of 4318 the list, it MUST use its name as known in the transport environment 4319 to which it is relaying the mail rather than that of the transport 4320 environment from which the mail came (if they are different). Note 4321 that a situation could easily arise in which some relay hosts add 4322 their names to the reverse source route and others do not, generating 4323 discontinuities in the routing list. This is another reason why 4324 servers needing to return a message SHOULD ignore the source route 4325 entirely and simply use the domain as specified in the Mailbox. 4327 Appendix D. Scenarios 4329 This section presents complete scenarios of several types of SMTP 4330 sessions. In the examples, "C:" indicates what is said by the SMTP 4331 client, and "S:" indicates what is said by the SMTP server. 4333 D.1. A Typical SMTP Transaction Scenario 4335 This SMTP example shows mail sent by Smith at host bar.com, and to 4336 Jones, Green, and Brown at host foo.com. Here we assume that host 4337 bar.com contacts host foo.com directly. The mail is accepted for 4338 Jones and Brown. Green does not have a mailbox at host foo.com. 4340 S: 220 foo.com Simple Mail Transfer Service Ready 4341 C: EHLO bar.com 4342 S: 250-foo.com greets bar.com 4343 S: 250-8BITMIME 4344 S: 250-SIZE 4345 S: 250-DSN 4346 S: 250 HELP 4347 C: MAIL FROM: 4348 S: 250 OK 4349 C: RCPT TO: 4350 S: 250 OK 4351 C: RCPT TO: 4352 S: 550 No such user here 4353 C: RCPT TO: 4354 S: 250 OK 4355 C: DATA 4356 S: 354 Start mail input; end with . 4357 C: Blah blah blah... 4358 C: ...etc. etc. etc. 4359 C: . 4360 S: 250 OK 4361 C: QUIT 4362 S: 221 foo.com Service closing transmission channel 4364 D.2. Aborted SMTP Transaction Scenario 4366 S: 220 foo.com Simple Mail Transfer Service Ready 4367 C: EHLO bar.com 4368 S: 250-foo.com greets bar.com 4369 S: 250-8BITMIME 4370 S: 250-SIZE 4371 S: 250-DSN 4372 S: 250 HELP 4373 C: MAIL FROM: 4374 S: 250 OK 4375 C: RCPT TO: 4376 S: 250 OK 4377 C: RCPT TO: 4378 S: 550 No such user here 4379 C: RSET 4380 S: 250 OK 4381 C: QUIT 4382 S: 221 foo.com Service closing transmission channel 4384 D.3. Relayed Mail Scenario 4386 Step 1 -- Source Host to Relay Host 4388 The source host performs a DNS lookup on XYZ.COM (the destination 4389 address) and finds DNS MX records specifying xyz.com as the best 4390 preference and foo.com as a lower preference. It attempts to open a 4391 connection to xyz.com and fails. It then opens a connection to 4392 foo.com, with the following dialogue: 4394 S: 220 foo.com Simple Mail Transfer Service Ready 4395 C: EHLO bar.com 4396 S: 250-foo.com greets bar.com 4397 S: 250-8BITMIME 4398 S: 250-SIZE 4399 S: 250-DSN 4400 S: 250 HELP 4401 C: MAIL FROM: 4402 S: 250 OK 4403 C: RCPT TO: 4404 S: 250 OK 4405 C: DATA 4406 S: 354 Start mail input; end with . 4407 C: Date: Thu, 21 May 1998 05:33:29 -0700 4408 C: From: John Q. Public 4409 C: Subject: The Next Meeting of the Board 4410 C: To: Jones@xyz.com 4411 C: 4412 C: Bill: 4413 C: The next meeting of the board of directors will be 4414 C: on Tuesday. 4415 C: John. 4416 C: . 4417 S: 250 OK 4418 C: QUIT 4419 S: 221 foo.com Service closing transmission channel 4421 Step 2 -- Relay Host to Destination Host 4423 foo.com, having received the message, now does a DNS lookup on 4424 xyz.com. It finds the same set of MX records, but cannot use the one 4425 that points to itself (or to any other host as a worse preference). 4426 It tries to open a connection to xyz.com itself and succeeds. Then 4427 we have: 4429 S: 220 xyz.com Simple Mail Transfer Service Ready 4430 C: EHLO foo.com 4431 S: 250 xyz.com is on the air 4432 C: MAIL FROM: 4433 S: 250 OK 4434 C: RCPT TO: 4435 S: 250 OK 4436 C: DATA 4437 S: 354 Start mail input; end with . 4438 C: Received: from bar.com by foo.com ; Thu, 21 May 1998 4439 C: 05:33:29 -0700 4440 C: Date: Thu, 21 May 1998 05:33:29 -0700 4441 C: From: John Q. Public 4442 C: Subject: The Next Meeting of the Board 4443 C: To: Jones@xyz.com 4444 C: 4445 C: Bill: 4446 C: The next meeting of the board of directors will be 4447 C: on Tuesday. 4448 C: John. 4449 C: . 4450 S: 250 OK 4451 C: QUIT 4452 S: 221 xyz.com Service closing transmission channel 4454 D.4. Verifying and Sending Scenario 4456 S: 220 foo.com Simple Mail Transfer Service Ready 4457 C: EHLO bar.com 4458 S: 250-foo.com greets bar.com 4459 S: 250-8BITMIME 4460 S: 250-SIZE 4461 S: 250-DSN 4462 S: 250-VRFY 4463 S: 250 HELP 4464 C: VRFY Crispin 4465 S: 250 Mark Crispin 4466 C: MAIL FROM: 4467 S: 250 OK 4468 C: RCPT TO: 4469 S: 250 OK 4470 C: DATA 4471 S: 354 Start mail input; end with . 4472 C: Blah blah blah... 4473 C: ...etc. etc. etc. 4474 C: . 4475 S: 250 OK 4476 C: QUIT 4477 S: 221 foo.com Service closing transmission channel 4479 Appendix E. Other Gateway Issues 4481 In general, gateways between the Internet and other mail systems 4482 SHOULD attempt to preserve any layering semantics across the 4483 boundaries between the two mail systems involved. Gateway- 4484 translation approaches that attempt to take shortcuts by mapping 4485 (such as mapping envelope information from one system to the message 4486 header section or body of another) have generally proven to be 4487 inadequate in important ways. Systems translating between 4488 environments that do not support both envelopes and a header section 4489 and Internet mail must be written with the understanding that some 4490 information loss is almost inevitable. 4492 Appendix F. Deprecated Features of RFC 821 4494 A few features of RFC 821 have proven to be problematic and SHOULD 4495 NOT be used in Internet mail. Some of these features were deprecated 4496 in RFC 2821 in 2001; source routing and two-digit years in dates were 4497 deprecated by RFC 1123 in 1989. Of the domain literal forms, RFC 4498 1123 required support only for the dotted decimal form. With the 4499 possible exception of old, hardware-embedded, applications, there is 4500 no longer any excuse for these features to appear on the contemporary 4501 Internet. [[CREF27: [5321bis] (2821ter) 2821bis Last Call Comment]] 4503 F.1. TURN 4505 This command, described in RFC 821, raises important security issues 4506 since, in the absence of strong authentication of the host requesting 4507 that the client and server switch roles, it can easily be used to 4508 divert mail from its correct destination. Its use is deprecated; 4509 SMTP systems SHOULD NOT use it unless the server can authenticate the 4510 client. 4512 F.2. Source Routing 4514 RFC 821 utilized the concept of explicit source routing to get mail 4515 from one host to another via a series of relays. The requirement to 4516 utilize source routes in regular mail traffic was eliminated by the 4517 introduction of the domain name system "MX" record and the last 4518 significant justification for them was eliminated by the 4519 introduction, in RFC 1123, of a clear requirement that addresses 4520 following an "@" must all be fully-qualified domain names. 4521 Consequently, the only remaining justifications for the use of source 4522 routes are support for very old SMTP clients or MUAs and in mail 4523 system debugging. They can, however, still be useful in the latter 4524 circumstance and for routing mail around serious, but temporary, 4525 problems such as problems with the relevant DNS records. 4527 SMTP servers MUST continue to accept source route syntax as specified 4528 in the main body of this document and in RFC 1123. They MAY, if 4529 necessary, ignore the routes and utilize only the target domain in 4530 the address. If they do utilize the source route, the message MUST 4531 be sent to the first domain shown in the address. In particular, a 4532 server MUST NOT guess at shortcuts within the source route. 4534 Clients SHOULD NOT utilize explicit source routing except under 4535 unusual circumstances, such as debugging or potentially relaying 4536 around firewall or mail system configuration errors. 4538 F.3. HELO 4540 As discussed in Sections 3.1 and 4.1.1, EHLO SHOULD be used rather 4541 than HELO when the server will accept the former. Servers MUST 4542 continue to accept and process HELO in order to support older 4543 clients. 4545 F.4. #-literals 4547 RFC 821 provided for specifying an Internet address as a decimal 4548 integer host number prefixed by a pound sign, "#". In practice, that 4549 form has been obsolete since the introduction of TCP/IP. It is 4550 deprecated and MUST NOT be used. 4552 F.5. Dates and Years 4554 When dates are inserted into messages by SMTP clients or servers 4555 (e.g., in trace header fields), four-digit years MUST BE used. Two- 4556 digit years are deprecated; three-digit years were never permitted in 4557 the Internet mail system. 4559 F.6. Sending versus Mailing 4561 In addition to specifying a mechanism for delivering messages to 4562 user's mailboxes, RFC 821 provided additional, optional, commands to 4563 deliver messages directly to the user's terminal screen. These 4564 commands (SEND, SAML, SOML) were rarely implemented, and changes in 4565 workstation technology and the introduction of other protocols may 4566 have rendered them obsolete even where they are implemented. 4568 [[5321bis Editor's Note: does this need a stronger reference to 821, 4569 2821, and/or 5321? Also, is anything else needed given the removal 4570 of these commands and comments about, e.g., their opening mail 4571 transaction sessions, from the mail body of the text?]] 4572 Clients SHOULD NOT provide SEND, SAML, or SOML as services. Servers 4573 MAY implement them. If they are implemented by servers, the 4574 implementation model specified in RFC 821 MUST be used and the 4575 command names MUST be published in the response to the EHLO command. 4577 Appendix G. Other Outstanding Issues 4579 [[RFC Editor: Please remove this section before publication.]] 4581 In December 2019, an issue was raised on the ietf-smtp@ietf.org list 4582 that led to a broad discussion of ways in which existing practice had 4583 diverged from the specifications and recommendations of RFC 5321 in 4584 the more than eleven years since it was published (some of those 4585 issues probably affect the boundary between RFC 5321 and 5322 and 4586 hence the latter as well). In most cases, those divergences call for 4587 revision of the Technical Specification to match the practice, 4588 clarification of the specification text in other ways, or a more 4589 comprehensive explanation of why the practices recommended by the 4590 specification should really be followed. 4592 Those discussions raised two other issues, which were that 4594 o The publication of the Submission Server specification of RFC 6409 4595 in November 2011 may not have been fully reflected in RFC 5321 4596 (despite the even earlier publication of RFC 4409) and 4598 o There may be inconsistencies between the July 2009 Internet Mail 4599 Architecture description of RFC 5598 and the model described in 4600 RFC 5321. The issue called out in Appendix G.3 below may be an 4601 example of one of those inconsistencies. 4603 Those discrepancies should be identified and discussed and decisions 4604 made to fix them (and where) or to ignore them and let them continue. 4606 There has also been discussion on the mailing list, perhaps amounting 4607 to very rough consensus, that any revision of RFC 5321 and/or 5322 4608 should be accompanied by a separate Applicability Statement document 4609 that would make recommendations about applicability or best practices 4610 in particular areas rather than trying to get everything into the two 4611 technical specifications. This appendix does not attempt to identify 4612 which issues should get which treatment. 4614 This work is now (starting in the last half of 2020) being considered 4615 in the EMAILCORE WG. This appendix will act as a temporary record of 4616 issues that should be discussed and decided upon before a revised 4617 SMTP specification (or a related Applicability Statement) is 4618 published, issues that have not been reflected in errata (see 4619 Appendix H.1 below for those covered by errata). 4621 Ticket numbers listed below reference the list in 4622 https://trac.ietf.org/trac/emailcore/report/1 . 4624 G.1. IP Address literals 4626 The specification is unclear about whether IP address literals, 4627 particularly IP address literals used as arguments to the EHLO 4628 command, are required to be accepted or whether they are allowed to 4629 be rejected as part of the general "operational necessity" exception. 4630 Some have suggested that rejection of them is so common as an anti- 4631 spam measure that the use of such literals should be deprecated 4632 entirely in the specification, others that the are still useful and 4633 used and/or that, whatever is said about IP address literals within 4634 an SMTP session (e.g., in MAIL or RCPT commands), they should 4635 continue to be allowed (and required) in EHLO. 4636 Ticket #1. 4638 G.2. Repeated Use of EHLO 4640 While the specification says that an SMTP client's sending EHLO again 4641 after it has been issued (starting an SMTP session and treats it as 4642 if RSET had been sent (closing the session) followed by EHLO, there 4643 are apparently applications, at least some of them involving setting 4644 up of secure connections, in which the second EHLO is required and 4645 does not imply RSET. Does the specification need to be adjusted to 4646 reflect or call out those cases? 4648 After extended discussion in October 2020, it appears that the 4649 easiest fix to these problems is to clarify the conditions for 4650 termination of a mail transaction in Section 3.3 and to clearly 4651 specify the effect of a second (or subsequent) EHLO command in 4652 Section 4.1.4. 4653 See also Appendix G.7.4. 4654 Ticket #2. Both changes have been made in draft-ietf-emailcore- 4655 rfc5321bis-01. 4657 G.3. Meaning of "MTA" and Related Terminology 4659 A terminology issue has come up about what the term "MTA" actually 4660 refers to, a question that became at least slightly more complicated 4661 when we formalized RFC 6409 Submission Servers. Does the document 4662 need to be adjusted to be more clear about this topic? Note that the 4663 answer may interact with the question asked in Section 2 above. 4664 Possibly along the same lines, RFC 2821 changed the RFC 821 4665 terminology from "sender-SMTP" and "receiver-SMTP" to "SMTP client" 4666 and "SMTP server" respectively. As things have evolved, it is 4667 possible that newer terminology is a source of confusion and that the 4668 terminology should be changed back, something that also needs 4669 discussion. 4670 Ticket #3. 4672 G.4. Originator, or Originating System, Authentication 4674 Should RFC 5321bis address authentication and related issues or 4675 should Section 3.9 or other text be reshaped (in addition to or 4676 instead of the comment on that section) to lay a better foundation 4677 for such work, either in the context of mailing lists or more 4678 generally? 4679 This may interact with Erratum 4055 and Ticket #30 below. 4681 G.5. Remove or deprecate the work-around from code 552 to 452 4683 The suggestion in Section 4.5.3.1.10 may have outlived its usefulness 4684 and/or be inconsistent with current practice. Should it be removed 4685 and/or explicitly deprecated? 4686 Ticket #5. 4688 G.6. Clarify where the protocol stands with respect to submission and 4689 TLS issues 4691 1. submission on port 587 4693 2. submission on port 465 4695 3. TLS relay on a port different from 25 (whenever) 4697 4. Recommendations about general use of transport layer (hop by hop) 4698 security, particularly encryption including consideration of RFC 4699 8314. 4701 G.7. Probably-substantive Discussion Topics Identified in Other Ways 4703 The following issues were identified as a group in the opening Note 4704 but called out specifically only in embedded CREF comments in earlier 4705 (-00 and -01) versions of this draft. 4707 G.7.1. Issues with 521, 554, and 556 codes 4709 See new Section 4.2.4.2. More text may be needed, there or 4710 elsewhere, about choices of codes in response to initial opening and 4711 to EHLO, especially to deal with selective policy rejections. 4712 Ticket #6. 4714 G.7.2. SMTP Model, terminology, and relationship to RFC 5598 4716 CREF comment in Section 2 and also CREF comment in Section 2.3.10 4718 G.7.3. Resolvable FQDNs and private domain names 4720 Multiple CREF comments in Section 2.3.5 4721 Tickets #9, #10 and #41. 4723 G.7.4. Possible clarification about mail transactions and transaction 4724 state 4726 CREF comment in Section 3.3 and also reference in Section 4.1.4 4727 Ticket #11. 4729 G.7.5. Issues with mailing lists, aliases, and forwarding 4731 CREF comment in Section 3.9. May also want to note forwarding as an 4732 email address portability issue. Note that, if changes are made in 4733 this area, they should be kept consistent with the description and 4734 discussion of the 251 and 551 in Section 4.2 and Section 3.5 as well 4735 as Section 3.4 to avoid introducing inconsistencies. In addition, 4736 there are some terminology issues about the use of the term "lists", 4737 identified in erratum 1820, that should be reviewed after any more 4738 substantive changes are made to the relevant sections. 4739 Ticket #12 and Ticket #34. 4741 G.7.6. Requirements for domain name and/or IP address in EHLO 4743 CREF comment in Section 4.1.4 4744 Ticket #19. 4746 G.7.7. Does the 'first digit only' and/or non-listed reply code text 4747 need clarification? 4749 Resolved. Text in Section 4.2 changed 2021-02-08 and CREF comment in 4750 Section 4.3.1 removed. 4751 Ticket #13. 4753 G.7.8. Size limits 4755 Once a decision is made about line length rules for RFC 5322bis, 4756 review the size limit discussions in this document, particularly the 4757 CREF comment (Note in Draft) at the end of the introductory material 4758 to Section 4.5.3 to be sure this document says what we want it to 4759 say. 4760 Ticket #14 and maybe Ticket #38. 4762 G.7.9. Discussion of 'blind' copies and RCPT 4764 CREF comment in Section 7.2. May also need to discussion whether 4765 that terminology is politically incorrect and suggest a replacement. 4766 Ticket #15. 4768 G.7.10. Further clarifications needed to source routes? 4770 The current text largely deprecates the use of source routes but 4771 suggests that servers continue to support them. Is additional work 4772 needed in this area? See CREF comment in Appendix C 4773 Ticket #17. 4775 G.7.11. Should 1yz Be Revisited? 4777 RFC 5321 depreciated the "positive preliminary reply" response code 4778 category with first digit "1", so that the first digit of valid SMTP 4779 response codes must be 2, 3, 4, or 5. It has been suggested (see 4780 mail from Hector Santos with Subject "SMTP Reply code 1yz Positive 4781 Preliminary reply", March 5, 2020 12:56 -0500, on the SMTP list) that 4782 these codes should be reinstated to deal with some situations that 4783 became more plausible after 5321 was published. Do we need to take 4784 this back up? 4785 Ticket #18. 4787 G.7.12. Review Timeout Specifications 4789 RFC 5321 (and its predecessors going back to 821) specify minimum 4790 periods for client and server to wait before timing out. Are those 4791 intervals still appropriate in a world of faster processors and 4792 faster networks? Should they be updated and revised? Or should more 4793 qualifying language be added? 4794 Ticket #16. 4796 G.7.13. Possible SEND, SAML, SOML Loose End 4798 Per discussion (and Ticket #20), the text about SEND, SAML, and SOML 4799 has been removed from the main body of the document so that the only 4800 discussion of them now appears in Appendix F.6. Per the editor's 4801 note in that appendix, is any further discussion needed? 4803 G.8. Enhanced Reply Codes and DSNs 4805 Enhanced Mail System Status Codes [34] were added to SMTP before RFC 4806 5321 was published and are now, together with a corresponding 4807 registry [46], widely deployed and in extensive use in the network. 4808 Similar, the structure and extensions options for Delivery Status 4809 Notifications [35] is implemented, deployed, and in wide use. Is it 4810 time to fold all or part of those mature specifications into the SMTP 4811 spec or at least to mention and normatively reference them? And, as 4812 an aside, do those specs need work or, if they are kept separate, is 4813 it time to move them to Internet Standard? 4815 G.9. Revisiting Quoted Strings 4817 Recent discussions both in and out of the IETF have highlighted 4818 instances of non-compliance with the specification of a Local-part 4819 consisting of a Quoted-string, whether any content of QcontentSMTP 4820 that actually requires special treatment consists of qtextSMTP, 4821 quoted-pairSMTP, or both. Section 4.1.2 (of RFC 5321, repeated 4822 above) ends with a few paragraphs of warnings (essentially a partial 4823 applicability statement), the first of which cautions against 4824 cleverness with either Quoted-string or case sensitivity as a threat 4825 to interoperability. 4827 The Quoted-string portion of that discussion has apparently been 4828 widely not read or ignored. Do we need to do something else? If we 4829 do an Applicability Statement, would it be useful to either reference 4830 the discussion in this document from there or to move the discussion 4831 there and reference it (normatively?) from here? 4833 There has been a separate discussion of empty quoted strings in 4834 addresses, i.e., whether the production should be 4835 required to included at least one non-whitespace character. It is 4836 separate from this issue but would be further impacted or distorted 4837 from the considerations identified in this Section. 4838 Ticket #21. May also interact with Ticket #35. 4840 G.10. Internationalization 4842 RFC 5321 came long before work on internationalization of email 4843 addresses and headers (other than by use of encoded words in MINE) 4844 and specifically before the work of the EAI WG leading to the 4845 SMTPUTF8 specifications, specifically RFCs 6530ff. The second 4846 explanatory paragraph at the end of Section 4.1.2 ("Systems MUST NOT 4847 define mailboxes ...") is an extremely strong prohibition against the 4848 use of non-ASCII characters in SMTP commands and the requirements 4849 about message content in Section 2.3.1 an equally strong one for 4850 content. Would it be appropriate to add something like "in the 4851 absence of relevant extensions" there? Also, given [mis]behavior 4852 seen in the wild, does that paragraph (or an A/S) need an explicit 4853 caution about SMTP servers or clients assuming they can apply the 4854 popular web convention of using %NN sequences as a way to encode non- 4855 ASCII characters ( in RFC 3986) and assuming some later 4856 system will interpret it as they expect? Would it be appropriate to 4857 add an Internationalization Considerations section to the body of 4858 this document if only for the purpose of pointing people elsewhere? 4860 More broadly, while the EAI WG's extensions for non-ASCII headers and 4861 addresses are explicitly out of scope for the EMAILCORE WG (at least 4862 for 5321bis (and 5322bis), those documents make assumptions and 4863 interpretations of the core documents. Are there areas in which 4864 5321bis could and should be clarified to lay a more solid foundation 4865 for the EAI/SMTPUTF8 work and, if so, what are they? 4867 G.11. SMTP Clients, Servers, Senders, and Receivers 4869 RFC 821 used the terms "SMTP-sender" and "SMTP-receiver". In RFC 4870 2821 (and hence in 5321), we switched that to "client" and "server" 4871 (See the discussion in Section 1.2). In part because a relay is a 4872 server and then a client (in some recent practice, even interleaving 4873 the two functions by opening the connection to the next host in line 4874 and sending commands before the incoming transaction is complete), 4875 RFC 5321 continues to use the original terminology in some places. 4876 Should we revisit that usage, possibly even returning to consistent 4877 use of the original terminology? 4879 G.12. Extension Keywords Starting in 'X-' 4881 Section 2.2.2 contains a discussion of SMTP keywords starting in "X". 4882 Given general experience with such things and RFC 6648, is there any 4883 reason to not deprecate that practice entirely and remove that text? 4884 If we do so, should Section 4.1.5 be dropped or rewritten to make 4885 clear this is an obsolete practice? 4886 Ticket #42. 4888 G.13. Deprecating HELO 4890 RFC 5321 (and 2821 before it) very carefully circle around the status 4891 of HELO, even recommending its use as a fallback when EHLO is sent 4892 and a "command not recognized" response is received. We are just a 4893 few months short of 20 years; is it time to deprecate the thing and 4894 clean out some or all of that text? And, given a recent (4Q2020) 4895 discussion on the EMAILCORE list, should EHLO be explicitly bound to 4896 SMTP over TCP with the older transports allowed only with HELO? 4897 While those questions may seem independent, separating them is fairly 4898 hard given the way the text is now constructed. 4900 Resolved 2021-01-19: No change 4901 Ticket #43. 4903 G.14. The FOR Clause in Trace Fields: Semantics, Security 4904 Considerations, and Other Issues 4906 The FOR clause in time-stamp ("Received:") fields is seriously under- 4907 defined. It is optional, the syntax is clear, but its semantics and 4908 use, while perhaps obvious from content and the application of common 4909 sense, have never been defined ("never" going back to 821). Do we 4910 want to better define it? Is there any chance that a definition 4911 would invalid existing, conforming and sensible, implementations? If 4912 we do want to define semantics, draft text and advice as to where it 4913 should go are invited. 4915 Note the existing discussions in Section 7.2 and Section 7.6 as they 4916 may need adjustment, or at least cross-references, if FOR is more 4917 precisely defined. 4919 There is probably an error in Section 7.6. Its last sentence implies 4920 a possible interaction between messages with multiple recipients and 4921 the FOR clause of trace fields. However, because the syntax of the 4922 FOR clause only allows one Mailbox (or Path), it isn't clear if that 4923 statement is meaningful. Should it be revised to discuss other 4924 situations in which including FOR might not be desirable from a 4925 security or privacy standpoint? 4927 Appendix H. RFC 5321 Errata Summary and Tentative Change Log 4929 [[RFC Editor: Please remove this section before publication.]] 4931 H.1. RFC 5321 Errata Summary 4933 This document addresses the following errata filed against RFC 5321 4934 since its publication in October 2008 [52]. As with the previous 4935 appendix, ticket numbers included below reference 4936 https://trac.ietf.org/trac/emailcore/report/1 . [[CREF28: [[Note in 4937 Draft: Items with comments below have not yet been resolved as 4938 errata. As of the end of November 2020, none of them have been 4939 checked and verified by the emailcore WG.]]]]. 4941 1683 ABNF error. Section 4.4 4942 Ticket #23. 4944 4198 Description error. Section 4.2. 4945 RESOLVED, ticket #24, 2020-12-14. 4947 2578 Syntax description error. Section 4.1.2 4949 1543 Wrong code in description Section 3.8 4950 Ticket #26 4952 4315 ABNF - IPv6 Section 4.1.3. [[CREF29: [5321bis]The IPv6 syntax 4953 has been adjusted since 5321 was published. See the rewritten 4954 form and the comment in the section cited in the previous 4955 sentence. The editor awaits instructions. See https://www.rfc- 4956 editor.org/errata/eid4315]] 4957 Ticket #27. 4959 5414 ABNF for Quoted-string Section 4.1.2 4960 Ticket #22. 4962 1851 Location of text on unexpected close Section 4.1.1.5. Text 4963 moved per email 2020-12-31. 4964 Ticket #28. 4966 3447 Use of normative language (e.g., more "MUST"s), possible 4967 confusion in some sections Section 4.4. [[CREF30: [5321bis]As 4968 Barry notes in his verifier comments on the erratum (see 4969 https://www.rfc-editor.org/errata/eid3447), the comments and 4970 suggestions here raise a number of interesting (and difficult) 4971 issues. One of the issues is that the core of RFCs 5321 (and 4972 2821) is text carried over from Jon Postel's RFC 821, a document 4973 that was not only written in a different style than the IETF uses 4974 today but that was written at a time when no one had dreamt of RFC 4975 2119 or even the IETF itself. It appears to me that trying to 4976 patch that style might easily result in a document that is harder 4977 to read as well as being error prone. If we want to get the 4978 document entirely into contemporary style, we really should bite 4979 the bullet and do a complete rewrite. To respond to a different 4980 point in Barry's discussion, I think an explicit statement that 4981 5321/5322 and their predecessors differ in places and why would be 4982 helpful. Text, and suggestions about where to put it, are 4983 solicited. A list of differences might be a good idea too, but 4984 getting it right might be more work than there is available energy 4985 to do correctly. ]] 4987 5711 Missing leading spaces in example Appendix D.3. [[CREF31: 4988 [5321bis]Well, this is interesting because the XML is correct and 4989 the spaces are there, embedded in artwork. So either the XML2RFC 4990 processor at the time took those leading spaces out or the RFC 4991 Editor improved on the document and the change was not caught in 4992 AUTH48, perhaps because rfcdiff ignores white space. We just need 4993 to watch for future iterations. ]] 4994 Ticket #29. 4996 4055 Erratum claims the the description of SPF and DKIM is wrong. 4997 It is not clear what 5321bis should really say about them, but the 4998 current text probably needs work (or dropping, which is what the 4999 proposed erratum suggests). See 5321bis Editor's Note in 5000 Section 3.6.2. 5001 Ticket #30. 5003 [[CREF32: [5321bis]Note that rejected errata have _not_ been reviewed 5004 to see if they contain anything useful that should be discussed again 5005 with the possibility of rethinking and changing text. Volunteers 5006 sought.]] 5008 H.2. Changes from RFC 5321 (published October 2008) to the initial 5009 (-00) version of this draft 5011 o Acknowledgments section (Section 9) trimmed back for new document. 5013 o Introductory paragraph to Appendix F extended to make it clear 5014 that these features were deprecated a long time ago and really 5015 should not be in use any more. 5017 o Adjusted some language to clarify that source routes really, 5018 really, should not be used or depended upon. 5020 o IPv6 address syntax replaced by a copy of the IPv6 URI syntax and 5021 a note added. 5023 o Production index added as a first step in tying all productions to 5024 their sources. As part of the effort to make the document more 5025 easily navigable, table of contents entries have been created for 5026 the individual command descriptions. 5028 o Clarified the relationship between the SMTP "letters, digits, and 5029 hyphens" and DNS "preferred name syntax" (Section 2.3.5). 5031 o Revised the reply code sections to add new 521 and 556 codes, 5032 clarify relationships, and be explicit about the requirement for 5033 clients to rely on first digits rather than the sequences in 5034 Section 4.3.2. 5036 o In conjunction with the above, explicitly obsolete RFCs 1846 and 5037 7504. 5039 o Incorporated a correction reflecting Errata ID 2578. 5041 o Some small editorial changes made to eliminate redundant 5042 statements that were very close together. Other, equally small, 5043 editorial changes have been made to improve grammar or clarity. 5045 o A few questions, marked "[[5321bis Editor's Note:", or "[[Note in 5046 Draft" have been added for the group to resolve. Other questions, 5047 especially those in the errata summary, are simply included in 5048 narrative comments in CREFs. 5050 o Checked and rationalized "response" (to a command) and "reply 5051 code" terminology. One can talk about a "999 response" but only a 5052 "999 reply code". There is no such thing as a "response code". 5054 o Added note about length limit on mailbox names ("email 5055 addresses"). 5057 o Added an "errata summary" subsection to this change log/ 5058 comparison to 5321 in this Appendix. The entire Appendix will, of 5059 course, disappear at the time of RFC publication unless someone 5060 wants to make a strong case for retaining it. 5062 o Rationalized CREFs to 2821, 5321, 5321bis etc.; added note to 5063 readers below the Abstract. 5065 o Temporarily added a "Note on Reading This Working Draft" after the 5066 Abstract. 5068 H.3. Changes Among Versions of Rfc5321bis 5070 H.3.1. Changes from draft-klensin-rfc5321bis-00 (posted 2012-12-02) to 5071 -01 5073 Substantively, these two versions differ only by suppression of the 5074 CREF and other discussion associated with the evolution from RFC 2821 5075 to RFC 5321. That change includes an update to the document's Note 5076 to Readers, the date, the file name, and the addition of this change 5077 log subsection. 5079 H.3.2. Changes from draft-klensin-rfc5321bis-01 (20191203) to -02 5081 o Minor clarifications to improve text, e.g., addition of NOOP to 5082 the list of non-mail transaction examples in Section 4.1.4. 5084 o Added topics exposed in the ietf-smtp list and the IETF list 5085 "dogfood" discussion during December 2019 and an index listing of 5086 substantive issues identified only in CREFs in the prior draft as 5087 a new Appendix G.. 5089 H.3.3. Changes from draft-klensin-rfc5321bis-02 (2019-12-27) to -03 5091 o Added more text to Appendix G.7.1 to specifically call out the 5092 session-opening policy issues surrounding these codes. 5094 o Added discussion of "1yz" reinstatement in Appendix G.7.11. 5096 o Added discussion of timeouts in Appendix G.7.12. 5098 o Added subsection on Enhanced Status Codes and DSNs to the 5099 outstanding issues list Appendix G.8. 5101 o Replaced reference to RFC 1652 (8BITMIME) with the Internet 5102 Standard version, RFC 6152. 5104 o With help from cketti, clarified the ABNF productions whose 5105 terminals appear in other documents. 5107 o Added discussions of Quoted-string, Internationalization, and 5108 client-server versus sender-receiver terminology to Appendix G. 5110 o Added note to the Abstract. 5112 H.3.4. Changes from draft-klensin-rfc5321bis-03 (2020-07-02) to draft- 5113 ietf-emailcore-rfc5321bis-00 5115 o Added a paragraph about non-null quoted strings to Appendix G.9. 5117 o Added an explicit pointer to email insecurity and TLS to 5118 Appendix G.6. Inspired by Ben Kaduk's comment on the WG Charter, 5119 2020-09-09. 5121 o Converted document from individual to emailcore WG effort. 5123 H.3.5. Changes from draft-ietf-emailcore-rfc5321bis-00 (2020-10-06) to 5124 -01 5126 o Editorial: Corrected "blackslash" to "backslash" 5128 o Rewrote the introduction to Appendix G slightly to reflect the 5129 creation of the EMAILCORE WG. 5131 o Applied fixes for repeated use of EHLO. See Appendix G.2. 5133 o Added two new questions, one about "X" extensions (Appendix G.12) 5134 and one about the status of HELO (Appendix G.13). 5136 o Removed mention of SEND, SAML, SOML from the main body of the text 5137 (Ticket #20). 5139 o Added a warning about side effects to Appendix G.7.5. 5141 o Added ticket numbers to descriptions of issues and changes, 5142 adjusted some text so relationships would be more clear, and added 5143 subsections to the Appendix G and H lists to pick up on tickets 5144 that were not easily identified in those sections of with the 5145 text. 5147 o Made several additions to the Index, including one to deal with 5148 SEND et al., as above. 5150 H.3.6. Changes from draft-ietf-emailcore-rfc5321bis-01 (2020-12-25) to 5151 -02 5153 o Corrected discussion mailing list to point to emailcore@ietf.org 5154 in the introductory note. 5156 o Added new subsection(s) to Appendix G to reflect newly discovered 5157 issues. 5159 o Changed "as discussed in" references in Section 4.5.5 per ticket 5160 #45. 5162 o Corrected a misleading use of the term "mailbox" in Section 3.3. 5164 o Changed descriptions of use of first digit in replies per ticket 5165 #13. See Appendix G.7.7. 5167 o Moved paragraph per ticket #28, erratum 1851. 5169 o Added more clarifying cross-references, clarified some CREFs, and 5170 cleaned out some of those that no longer seemed relevant. 5172 o Removed "updates 1123" is unnecessary and obsolete. 5174 o Updated several references. 5176 Index 5178 A 5179 Argument Syntax 5180 A-d-l 43 5181 Additional-Registered-Clauses 63 5182 address-literal 43 5183 Addtl-Link 64 5184 Addtl-Protocol 64 5185 ALPHA 42 5186 Argument 43 5187 At-domain 43 5188 atext 43 5189 Atom 44 5190 By-domain 63 5191 CFWS 43 5192 CRLF 42 5193 dcontent 45 5194 DIGIT 42 5195 Domain 43 5196 Dot-string 44 5197 esmtp-keyword 43 5198 esmtp-param 43 5199 esmtp-value 43 5200 Extended-Domain 63 5201 For 63 5202 Forward-Path 43 5203 From-domain 63 5204 FWS 43 5205 General-address-literal 45 5206 Greeting 49 5207 h16 46 5208 HEXDIG 42 5209 ID 63 5210 IPv4-address-literal 45 5211 IPv6-addr 46 5212 IPv6-address-literal 45 5213 Keyword 43 5214 Ldh-str 43 5215 Let-dig 43 5216 Link 63 5217 Local-part 44 5218 ls32 46 5219 Mail-parameters 43 5220 Mailbox 43 5221 Opt-info 63 5222 Path 43 5223 Protocol 64 5224 QcontentSMTP 44 5225 qtextSMTP 44 5226 quoted-pairSMTP 44 5227 Quoted-string 44 5228 Rcpt-parameters 43 5229 Reply-code 49 5230 Reply-line 49 5231 Return-path-line 63 5232 Reverse-Path 43 5233 Snum 46 5234 SP 42 5235 Stamp 63 5236 Standardized-tag 45 5237 String 44 5238 sub-domain 43 5239 TCP-info 63 5240 textstring 49 5241 Time-stamp-line 63 5242 Via 63 5243 With 63 5245 C 5246 Command Syntax 5247 data 40 5248 ehlo 20, 35 5249 expn 41 5250 helo 35 5251 help 41 5252 mail 37 5253 noop 41 5254 quit 42 5255 rcpt 38 5256 rset 40 5257 send, saml, soml 102 5258 vrfy 40 5260 Author's Address 5262 John C. Klensin 5263 1770 Massachusetts Ave, Suite 322 5264 Cambridge, MA 02140 5265 USA 5267 EMail: john-ietf@jck.com