idnits 2.17.00 (12 Aug 2021) /tmp/idnits64684/draft-ietf-emailcore-rfc5321bis-03.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 (July 10, 2021) is 314 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 3096 -- 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. '13') (Obsoleted by RFC 2822) -- Obsolete informational reference (is this intentional?): RFC 974 (ref. '16') (Obsoleted by RFC 2821) -- Obsolete informational reference (is this intentional?): RFC 1869 (ref. '22') (Obsoleted by RFC 2821) -- Obsolete informational reference (is this intentional?): RFC 2821 (ref. '30') (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 (==), 12 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 EMAILCORE J. Klensin 3 Internet-Draft July 10, 2021 4 Obsoletes: 5321, 1846, 7504 (if 5 approved) 6 Intended status: Standards Track 7 Expires: January 11, 2022 9 Simple Mail Transfer Protocol 10 draft-ietf-emailcore-rfc5321bis-03 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 Notes 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. As one can 39 tell from the dates (when they are given), this document has been 40 periodically updated over a very long period of time. 42 As people review or try to use this document, it may be worth paying 43 special attention to the historical discussion in Section 1.2. The 44 decision to merge documents rather than do a complete rewrite was 45 motivated by weighing the risks of inadvertently introducing changes 46 against greater readability and deciding to preserve close 47 approximations to original text and document structures in most 48 cases. One result is that information may not be be organized as the 49 reader might expect. An index is provided to assist in the quest for 50 information. 52 This evolving draft should be discussed on the emailcore@ietf.org 53 list. 55 Technology Note: The table of contents would be much easier to use, 56 especially for locating commands, if the subsections containing the 57 commands where listed. The source XML is marked up with 58 "toc=include" attributes to facilitate that. Unfortunately, there is 59 apparently a bug in the current version of xml2rfc v2, one that also 60 appeared in the version used ot generate RFC 5321, that prevents 61 those subsections from appearing in the TOC. The command names can 62 now be found in the index, but the index is to page numbers, not 63 section numbers. Both problems have been reported. 65 Status of This Memo 67 This Internet-Draft is submitted in full conformance with the 68 provisions of BCP 78 and BCP 79. 70 Internet-Drafts are working documents of the Internet Engineering 71 Task Force (IETF). Note that other groups may also distribute 72 working documents as Internet-Drafts. The list of current Internet- 73 Drafts is at https://datatracker.ietf.org/drafts/current/. 75 Internet-Drafts are draft documents valid for a maximum of six months 76 and may be updated, replaced, or obsoleted by other documents at any 77 time. It is inappropriate to use Internet-Drafts as reference 78 material or to cite them other than as "work in progress." 80 This Internet-Draft will expire on January 11, 2022. 82 Copyright Notice 84 Copyright (c) 2021 IETF Trust and the persons identified as the 85 document authors. All rights reserved. 87 This document is subject to BCP 78 and the IETF Trust's Legal 88 Provisions Relating to IETF Documents 89 (https://trustee.ietf.org/license-info) in effect on the date of 90 publication of this document. Please review these documents 91 carefully, as they describe your rights and restrictions with respect 92 to this document. Code Components extracted from this document must 93 include Simplified BSD License text as described in Section 4.e of 94 the Trust Legal Provisions and are provided without warranty as 95 described in the Simplified BSD License. 97 Table of Contents 99 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 6 100 1.1. Transport of Electronic Mail . . . . . . . . . . . . . . 6 101 1.2. History and Context for This Document . . . . . . . . . . 7 102 1.3. Document Conventions . . . . . . . . . . . . . . . . . . 8 103 2. The SMTP Model . . . . . . . . . . . . . . . . . . . . . . . 8 104 2.1. Basic Structure . . . . . . . . . . . . . . . . . . . . . 9 105 2.2. The Extension Model . . . . . . . . . . . . . . . . . . . 11 106 2.2.1. Background . . . . . . . . . . . . . . . . . . . . . 11 107 2.2.2. Definition and Registration of Extensions . . . . . . 12 108 2.2.3. Special Issues with Extensions . . . . . . . . . . . 13 109 2.3. SMTP Terminology . . . . . . . . . . . . . . . . . . . . 13 110 2.3.1. Mail Objects . . . . . . . . . . . . . . . . . . . . 13 111 2.3.2. Senders and Receivers . . . . . . . . . . . . . . . . 14 112 2.3.3. Mail Agents and Message Stores . . . . . . . . . . . 14 113 2.3.4. Host . . . . . . . . . . . . . . . . . . . . . . . . 14 114 2.3.5. Domain Names . . . . . . . . . . . . . . . . . . . . 15 115 2.3.6. Buffer and State Table . . . . . . . . . . . . . . . 16 116 2.3.7. Commands and Replies . . . . . . . . . . . . . . . . 16 117 2.3.8. Lines . . . . . . . . . . . . . . . . . . . . . . . . 16 118 2.3.9. Message Content and Mail Data . . . . . . . . . . . . 16 119 2.3.10. Originator, Delivery, Relay, and Gateway Systems . . 17 120 2.3.11. Mailbox and Address . . . . . . . . . . . . . . . . . 17 121 2.4. General Syntax Principles and Transaction Model . . . . . 18 122 3. The SMTP Procedures: An Overview . . . . . . . . . . . . . . 19 123 3.1. Session Initiation . . . . . . . . . . . . . . . . . . . 20 124 3.2. Client Initiation . . . . . . . . . . . . . . . . . . . . 20 125 3.3. Mail Transactions . . . . . . . . . . . . . . . . . . . . 21 126 3.4. Forwarding for Address Correction or Updating . . . . . . 24 127 3.5. Commands for Debugging Addresses . . . . . . . . . . . . 24 128 3.5.1. Overview . . . . . . . . . . . . . . . . . . . . . . 25 129 3.5.2. VRFY Normal Response . . . . . . . . . . . . . . . . 27 130 3.5.3. Meaning of VRFY or EXPN Success Response . . . . . . 27 131 3.5.4. Semantics and Applications of EXPN . . . . . . . . . 28 132 3.6. Relaying and Mail Routing . . . . . . . . . . . . . . . . 28 133 3.6.1. Source Routes and Relaying . . . . . . . . . . . . . 28 134 3.6.2. Mail eXchange Records and Relaying . . . . . . . . . 29 135 3.6.3. Message Submission Servers as Relays . . . . . . . . 29 136 3.7. Mail Gatewaying . . . . . . . . . . . . . . . . . . . . . 30 137 3.7.1. Header Fields in Gatewaying . . . . . . . . . . . . . 31 138 3.7.2. Received Lines in Gatewaying . . . . . . . . . . . . 31 139 3.7.3. Addresses in Gatewaying . . . . . . . . . . . . . . . 31 140 3.7.4. Other Header Fields in Gatewaying . . . . . . . . . . 32 141 3.7.5. Envelopes in Gatewaying . . . . . . . . . . . . . . . 32 142 3.8. Terminating Sessions and Connections . . . . . . . . . . 32 143 3.9. Mailing Lists and Aliases . . . . . . . . . . . . . . . . 33 144 3.9.1. Alias . . . . . . . . . . . . . . . . . . . . . . . . 34 145 3.9.2. List . . . . . . . . . . . . . . . . . . . . . . . . 34 146 4. The SMTP Specifications . . . . . . . . . . . . . . . . . . . 34 147 4.1. SMTP Commands . . . . . . . . . . . . . . . . . . . . . . 34 148 4.1.1. Command Semantics and Syntax . . . . . . . . . . . . 34 149 4.1.2. Command Argument Syntax . . . . . . . . . . . . . . . 43 150 4.1.3. Address Literals . . . . . . . . . . . . . . . . . . 45 151 4.1.4. Order of Commands . . . . . . . . . . . . . . . . . . 46 152 4.1.5. Private-Use Commands . . . . . . . . . . . . . . . . 48 153 4.2. SMTP Replies . . . . . . . . . . . . . . . . . . . . . . 48 154 4.2.1. Reply Code Severities and Theory . . . . . . . . . . 50 155 4.2.2. Reply Codes by Function Groups . . . . . . . . . . . 53 156 4.2.3. Reply Codes in Numeric Order . . . . . . . . . . . . 54 157 4.2.4. Some specific code situations and relationships . . . 56 158 4.3. Sequencing of Commands and Replies . . . . . . . . . . . 57 159 4.3.1. Sequencing Overview . . . . . . . . . . . . . . . . . 57 160 4.3.2. Command-Reply Sequences . . . . . . . . . . . . . . . 58 161 4.4. Trace Information . . . . . . . . . . . . . . . . . . . . 60 162 4.5. Additional Implementation Issues . . . . . . . . . . . . 64 163 4.5.1. Minimum Implementation . . . . . . . . . . . . . . . 64 164 4.5.2. Transparency . . . . . . . . . . . . . . . . . . . . 65 165 4.5.3. Sizes and Timeouts . . . . . . . . . . . . . . . . . 66 166 4.5.4. Retry Strategies . . . . . . . . . . . . . . . . . . 70 167 4.5.5. Messages with a Null Reverse-Path . . . . . . . . . . 72 168 5. Address Resolution and Mail Handling . . . . . . . . . . . . 72 169 5.1. Locating the Target Host . . . . . . . . . . . . . . . . 72 170 5.2. IPv6 and MX Records . . . . . . . . . . . . . . . . . . . 75 171 6. Problem Detection and Handling . . . . . . . . . . . . . . . 75 172 6.1. Reliable Delivery and Replies by Email . . . . . . . . . 75 173 6.2. Unwanted, Unsolicited, and "Attack" Messages . . . . . . 76 174 6.3. Loop Detection . . . . . . . . . . . . . . . . . . . . . 77 175 6.4. Compensating for Irregularities . . . . . . . . . . . . . 77 176 7. Security Considerations . . . . . . . . . . . . . . . . . . . 78 177 7.1. Mail Security and Spoofing . . . . . . . . . . . . . . . 79 178 7.2. "Blind" Copies . . . . . . . . . . . . . . . . . . . . . 80 179 7.3. VRFY, EXPN, and Security . . . . . . . . . . . . . . . . 80 180 7.4. Mail Rerouting Based on the 251 and 551 Response 181 Codes . . . . . . . . . . . . . . . . . . . . . . . . . . 81 182 7.5. Information Disclosure in Announcements . . . . . . . . . 81 183 7.6. Information Disclosure in Trace Fields . . . . . . . . . 82 184 7.7. Information Disclosure in Message Forwarding . . . . . . 82 185 7.8. Local Operational Requirement and Resistance to Attacks . 82 186 7.9. Scope of Operation of SMTP Servers . . . . . . . . . . . 82 187 8. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 83 188 9. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 84 189 10. References . . . . . . . . . . . . . . . . . . . . . . . . . 85 190 10.1. Normative References . . . . . . . . . . . . . . . . . . 85 191 10.2. Informative References . . . . . . . . . . . . . . . . . 86 192 Appendix A. TCP Transport Service . . . . . . . . . . . . . . . 91 193 Appendix B. Generating SMTP Commands from RFC 822 Header Fields 91 194 Appendix C. Source Routes . . . . . . . . . . . . . . . . . . . 92 195 Appendix D. Scenarios . . . . . . . . . . . . . . . . . . . . . 93 196 D.1. A Typical SMTP Transaction Scenario . . . . . . . . . . . 93 197 D.2. Aborted SMTP Transaction Scenario . . . . . . . . . . . . 94 198 D.3. Relayed Mail Scenario . . . . . . . . . . . . . . . . . . 95 199 D.4. Verifying and Sending Scenario . . . . . . . . . . . . . 96 200 Appendix E. Other Gateway Issues . . . . . . . . . . . . . . . . 97 201 Appendix F. Deprecated Features of RFC 821 . . . . . . . . . . . 97 202 F.1. TURN . . . . . . . . . . . . . . . . . . . . . . . . . . 97 203 F.2. Source Routing . . . . . . . . . . . . . . . . . . . . . 97 204 F.3. HELO . . . . . . . . . . . . . . . . . . . . . . . . . . 98 205 F.4. #-literals . . . . . . . . . . . . . . . . . . . . . . . 98 206 F.5. Dates and Years . . . . . . . . . . . . . . . . . . . . . 98 207 F.6. Sending versus Mailing . . . . . . . . . . . . . . . . . 98 208 Appendix G. Other Outstanding Issues . . . . . . . . . . . . . . 99 209 G.1. IP Address literals . . . . . . . . . . . . . . . . . . . 100 210 G.2. Repeated Use of EHLO . . . . . . . . . . . . . . . . . . 100 211 G.3. Meaning of "MTA" and Related Terminology . . . . . . . . 100 212 G.4. Originator, or Originating System, Authentication . . . . 101 213 G.5. Remove or deprecate the work-around from code 552 to 452 101 214 G.6. Clarify where the protocol stands with respect to 215 submission and TLS issues . . . . . . . . . . . . . . . . 101 216 G.7. Probably-substantive Discussion Topics Identified in 217 Other Ways . . . . . . . . . . . . . . . . . . . . . . . 101 218 G.7.1. Issues with 521, 554, and 556 codes . . . . . . . . . 101 219 G.7.2. SMTP Model, terminology, and relationship to RFC 5598 102 220 G.7.3. Resolvable FQDNs and private domain names . . . . . . 102 221 G.7.4. Possible clarification about mail transactions and 222 transaction state . . . . . . . . . . . . . . . . . . 102 223 G.7.5. Issues with mailing lists, aliases, and forwarding . 102 224 G.7.6. Requirements for domain name and/or IP address in 225 EHLO . . . . . . . . . . . . . . . . . . . . . . . . 102 226 G.7.7. Does the 'first digit only' and/or non-listed reply 227 code text need clarification? . . . . . . . . . . . . 102 228 G.7.8. Size limits . . . . . . . . . . . . . . . . . . . . . 103 229 G.7.9. Discussion of 'blind' copies and RCPT . . . . . . . . 103 230 G.7.10. Further clarifications needed to source routes? . . . 103 231 G.7.11. Should 1yz Be Revisited? . . . . . . . . . . . . . . 103 232 G.7.12. Review Timeout Specifications . . . . . . . . . . . . 103 233 G.7.13. Possible SEND, SAML, SOML Loose End . . . . . . . . . 104 234 G.7.14. Abstract Update . . . . . . . . . . . . . . . . . . . 104 235 G.7.15. Informative References to MIME and/or Message 236 Submission . . . . . . . . . . . . . . . . . . . . . 104 237 G.7.16. Mail Transaction Discussion . . . . . . . . . . . . . 104 238 G.7.17. Hop-by-hop Authentication and/or Encryption . . . . . 104 239 G.7.18. More Text About 554 Given 521, etc. . . . . . . . . . 104 240 G.7.19. Minimum Lengths and Quantities . . . . . . . . . . . 104 242 G.8. Enhanced Reply Codes and DSNs . . . . . . . . . . . . . . 104 243 G.9. Revisiting Quoted Strings . . . . . . . . . . . . . . . . 105 244 G.10. Internationalization . . . . . . . . . . . . . . . . . . 105 245 G.11. SMTP Clients, Servers, Senders, and Receivers . . . . . . 106 246 G.12. Extension Keywords Starting in 'X-' . . . . . . . . . . . 106 247 G.13. Deprecating HELO . . . . . . . . . . . . . . . . . . . . 106 248 G.14. The FOR Clause in Trace Fields: Semantics, Security 249 Considerations, and Other Issues . . . . . . . . . . . . 107 250 G.15. Resistance to Attacks and Operational Necessity . . . . . 107 251 Appendix H. RFC 5321 Errata Summary and Tentative Change Log . . 107 252 H.1. RFC 5321 Errata Summary . . . . . . . . . . . . . . . . . 108 253 H.2. Changes from RFC 5321 (published October 2008) to the 254 initial (-00) version of this draft . . . . . . . . . . . 109 255 H.3. Changes Among Versions of Rfc5321bis . . . . . . . . . . 111 256 H.3.1. Changes from draft-klensin-rfc5321bis-00 (posted 257 2012-12-02) to -01 . . . . . . . . . . . . . . . . . 111 258 H.3.2. Changes from draft-klensin-rfc5321bis-01 (20191203) 259 to -02 . . . . . . . . . . . . . . . . . . . . . . . 111 260 H.3.3. Changes from draft-klensin-rfc5321bis-02 (2019-12-27) 261 to -03 . . . . . . . . . . . . . . . . . . . . . . . 111 262 H.3.4. Changes from draft-klensin-rfc5321bis-03 (2020-07-02) 263 to draft-ietf-emailcore-rfc5321bis-00 . . . . . . . . 112 264 H.3.5. Changes from draft-ietf-emailcore-rfc5321bis-00 265 (2020-10-06) to -01 . . . . . . . . . . . . . . . . . 112 266 H.3.6. Changes from draft-ietf-emailcore-rfc5321bis-01 267 (2020-12-25) to -02 . . . . . . . . . . . . . . . . . 112 268 H.3.7. Changes from draft-ietf-emailcore-rfc5321bis-02 269 (2021-02-21) to -03 . . . . . . . . . . . . . . . . . 113 270 Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114 271 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 116 273 1. Introduction 275 1.1. Transport of Electronic Mail 277 The objective of the Simple Mail Transfer Protocol (SMTP) is to 278 transfer mail reliably and efficiently. 280 SMTP is independent of the particular transmission subsystem and 281 requires only a reliable ordered data stream channel. While this 282 document specifically discusses transport over TCP, other transports 283 are possible. Appendices to RFC 821 [3] describe some of them. 285 An important feature of SMTP is its capability to transport mail 286 across multiple networks, usually referred to as "SMTP mail relaying" 287 (see Section 3.6). A network consists of the mutually-TCP-accessible 288 hosts on the public Internet, the mutually-TCP-accessible hosts on a 289 firewall-isolated TCP/IP Intranet, or hosts in some other LAN or WAN 290 environment utilizing a non-TCP transport-level protocol. Using 291 SMTP, a process can transfer mail to another process on the same 292 network or to some other network via a relay or gateway process 293 accessible to both networks. 295 In this way, a mail message may pass through a number of intermediate 296 relay or gateway hosts on its path from sender to ultimate recipient. 297 The Mail eXchanger mechanisms of the domain name system (RFC 1035 298 [4], RFC 974 [16], and Section 5 of this document) are used to 299 identify the appropriate next-hop destination for a message being 300 transported. 302 1.2. History and Context for This Document 304 This document is a specification of the basic protocol for the 305 Internet electronic mail transport. It consolidates, updates and 306 clarifies, but does not add new or change existing functionality of 307 the following: 309 o the original SMTP (Simple Mail Transfer Protocol) specification of 310 RFC 821 [3], 312 o domain name system requirements and implications for mail 313 transport from RFC 1035 [4] and RFC 974 [16], 315 o the clarifications and applicability statements in RFC 1123 [5], 317 o the new error codes added by RFC 1846 [20] and later by RFC 7504 318 [48], obsoleting both of those documents, and 320 o material drawn from the SMTP Extension mechanisms in RFC 1869 321 [22]. 323 o Editorial and clarification changes to RFC 2821 [30] to bring that 324 specification to Draft Standard. 326 It obsoletes RFC 821, RFC 974, RFC 1869, and RFC 2821 and updates RFC 327 1123 (replacing the mail transport materials of RFC 1123). However, 328 RFC 821 specifies some features that were not in significant use in 329 the Internet by the mid-1990s and (in appendices) some additional 330 transport models. Those sections are omitted here in the interest of 331 clarity and brevity; readers needing them should refer to RFC 821. 333 It also includes some additional material from RFC 1123 that required 334 amplification. This material has been identified in multiple ways, 335 mostly by tracking flaming on various lists and newsgroups and 336 problems of unusual readings or interpretations that have appeared as 337 the SMTP extensions have been deployed. Where this specification 338 moves beyond consolidation and actually differs from earlier 339 documents, it supersedes them technically as well as textually. 341 Although SMTP was designed as a mail transport and delivery protocol, 342 this specification also contains information that is important to its 343 use as a "mail submission" protocol, as recommended for Post Office 344 Protocol (POP) (RFC 937 [14], RFC 1939 [23]) and IMAP (RFC 3501 345 [36]). In general, the separate mail submission protocol specified 346 in RFC 6409 [42] is now preferred to direct use of SMTP; more 347 discussion of that subject appears in that document. 349 Section 2.3 provides definitions of terms specific to this document. 350 Except when the historical terminology is necessary for clarity, this 351 document uses the current 'client' and 'server' terminology to 352 identify the sending and receiving SMTP processes, respectively. 354 A companion document, RFC 5322 [12], discusses message header 355 sections and bodies and specifies formats and structures for them. 356 [[CREF2: [rfc5321bis 20210317] Would this be an appropriate place to 357 mention RFC 2045 (MIME) and/or RFC 6409 (Message Submission)?]] 359 1.3. Document Conventions 361 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 362 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 363 document are to be interpreted as described in RFC 2119 [1]. As each 364 of these terms was intentionally and carefully chosen to improve the 365 interoperability of email, each use of these terms is to be treated 366 as a conformance requirement. 368 Because this document has a long history and to avoid the risk of 369 various errors and of confusing readers and documents that point to 370 this one, most examples and the domain names they contain are 371 preserved from RFC 2821. Readers are cautioned that these are 372 illustrative examples that should not actually be used in either code 373 or configuration files. 375 2. The SMTP Model 377 [[CREF3: [5321bis] [[Editor's Note: There have been extensive and 378 repeated discussions on the SMTP and IETF lists about whether this 379 document should say something about hop-by-hop (MTA-to-MTA) SMTP 380 authentication and, if so, what?? Note that end to end message 381 authentication is almost certainly out of scope for SMTP.]]]] 383 2.1. Basic Structure 385 The SMTP design can be pictured as: 387 +----------+ +----------+ 388 +------+ | | | | 389 | User |<-->| | SMTP | | 390 +------+ | Client- |Commands/Replies| Server- | 391 +------+ | SMTP |<-------------->| SMTP | +------+ 392 | File |<-->| | and Mail | |<-->| File | 393 |System| | | | | |System| 394 +------+ +----------+ +----------+ +------+ 395 SMTP client SMTP server 397 When an SMTP client has a message to transmit, it establishes a two- 398 way transmission channel to an SMTP server. The responsibility of an 399 SMTP client is to transfer mail messages to one or more SMTP servers, 400 or report its failure to do so. 402 The means by which a mail message is presented to an SMTP client, and 403 how that client determines the identifier(s) ("names") of the 404 domain(s) to which mail messages are to be transferred, are local 405 matters. They are not addressed by this document. In some cases, 406 the designated domain(s), or those determined by an SMTP client, will 407 identify the final destination(s) of the mail message. In other 408 cases, common with SMTP clients associated with implementations of 409 the POP (RFC 937 [14], RFC 1939 [23]) or IMAP (RFC 3501 [36]) 410 protocols, or when the SMTP client is inside an isolated transport 411 service environment, the domain determined will identify an 412 intermediate destination through which all mail messages are to be 413 relayed. SMTP clients that transfer all traffic regardless of the 414 target domains associated with the individual messages, or that do 415 not maintain queues for retrying message transmissions that initially 416 cannot be completed, may otherwise conform to this specification but 417 are not considered fully-capable. Fully-capable SMTP 418 implementations, including the relays used by these less capable 419 ones, and their destinations, are expected to support all of the 420 queuing, retrying, and alternate address functions discussed in this 421 specification. In many situations and configurations, the less- 422 capable clients discussed above SHOULD be using the message 423 submission protocol (RFC 6409 [42]) rather than SMTP. 425 The means by which an SMTP client, once it has determined a target 426 domain, determines the identity of an SMTP server to which a copy of 427 a message is to be transferred, and then performs that transfer, are 428 covered by this document. To effect a mail transfer to an SMTP 429 server, an SMTP client establishes a two-way transmission channel to 430 that SMTP server. An SMTP client determines the address of an 431 appropriate host running an SMTP server by resolving a destination 432 domain name to either an intermediate Mail eXchanger host or a final 433 target host. 435 An SMTP server may be either the ultimate destination or an 436 intermediate "relay" (that is, it may assume the role of an SMTP 437 client after receiving the message) or "gateway" (that is, it may 438 transport the message further using some protocol other than SMTP). 439 SMTP commands are generated by the SMTP client and sent to the SMTP 440 server. SMTP replies are sent from the SMTP server to the SMTP 441 client in response to the commands. 443 In other words, message transfer can occur in a single connection 444 between the original SMTP-sender and the final SMTP-recipient, or can 445 occur in a series of hops through intermediary systems. In either 446 case, once the server has issued a success response at the end of the 447 mail data, a formal handoff of responsibility for the message occurs: 448 the protocol requires that a server MUST accept responsibility for 449 either delivering the message or properly reporting the failure to do 450 so (see Sections 6.1, 6.2, and 7.8, below). 452 Once the transmission channel is established and initial handshaking 453 is completed, the SMTP client normally initiates a mail transaction. 454 Such a transaction consists of a series of commands to specify the 455 originator and destination of the mail and transmission of the 456 message content (including any lines in the header section or other 457 structure) itself. When the same message is sent to multiple 458 recipients, this protocol encourages the transmission of only one 459 copy of the data for all recipients at the same destination (or 460 intermediate relay) host. 462 The server responds to each command with a reply; replies may 463 indicate that the command was accepted, that additional commands are 464 expected, or that a temporary or permanent error condition exists. 465 Commands specifying the sender or recipients may include server- 466 permitted SMTP service extension requests, as discussed in 467 Section 2.2. The dialog is purposely lock-step, one-at-a-time, 468 although this can be modified by mutually agreed upon extension 469 requests such as command pipelining (RFC 2920 [31]). 471 Once a given mail message has been transmitted, the client may either 472 request that the connection be shut down or may initiate other mail 473 transactions. In addition, an SMTP client may use a connection to an 474 SMTP server for ancillary services such as verification of email 475 addresses or retrieval of mailing list subscriber addresses. 477 As suggested above, this protocol provides mechanisms for the 478 transmission of mail. Historically, this transmission normally 479 occurred directly from the sending user's host to the receiving 480 user's host when the two hosts are connected to the same transport 481 service. When they are not connected to the same transport service, 482 transmission occurs via one or more relay SMTP servers. A very 483 common case in the Internet today involves submission of the original 484 message to an intermediate, "message submission" server, which is 485 similar to a relay but has some additional properties; such servers 486 are discussed in Section 2.3.10 and at some length in RFC 6409 [42]. 487 An intermediate host that acts as either an SMTP relay or as a 488 gateway into some other transmission environment is usually selected 489 through the use of the domain name service (DNS) Mail eXchanger 490 mechanism. Explicit "source" routing (see Section 5 and Appendix C 491 and Appendix F.2) SHOULD NOT be used. 493 2.2. The Extension Model 495 2.2.1. Background 497 In an effort that started in 1990, approximately a decade after RFC 498 821 was completed, the protocol was modified with a "service 499 extensions" model that permits the client and server to agree to 500 utilize shared functionality beyond the original SMTP requirements. 501 The SMTP extension mechanism defines a means whereby an extended SMTP 502 client and server may recognize each other, and the server can inform 503 the client as to the service extensions that it supports. 505 Contemporary SMTP implementations MUST support the basic extension 506 mechanisms. For instance, servers MUST support the EHLO command even 507 if they do not implement any specific extensions and clients SHOULD 508 preferentially utilize EHLO rather than HELO. (However, for 509 compatibility with older conforming implementations, SMTP clients and 510 servers MUST support the original HELO mechanisms as a fallback.) 511 Unless the different characteristics of HELO must be identified for 512 interoperability purposes, this document discusses only EHLO. 514 SMTP is widely deployed and high-quality implementations have proven 515 to be very robust. However, the Internet community now considers 516 some services to be important that were not anticipated when the 517 protocol was first designed. If support for those services is to be 518 added, it must be done in a way that permits older implementations to 519 continue working acceptably. The extension framework consists of: 521 o The SMTP command EHLO, superseding the earlier HELO, 523 o a registry of SMTP service extensions, 525 o additional parameters to the SMTP MAIL and RCPT commands, and 526 o optional replacements for commands defined in this protocol, such 527 as for DATA in non-ASCII transmissions (RFC 3030 [33]). 529 SMTP's strength comes primarily from its simplicity. Experience with 530 many protocols has shown that protocols with few options tend towards 531 ubiquity, whereas protocols with many options tend towards obscurity. 533 Each and every extension, regardless of its benefits, must be 534 carefully scrutinized with respect to its implementation, deployment, 535 and interoperability costs. In many cases, the cost of extending the 536 SMTP service will likely outweigh the benefit. 538 2.2.2. Definition and Registration of Extensions 540 The IANA maintains a registry of SMTP service extensions [53]. A 541 corresponding EHLO keyword value is associated with each extension. 542 Each service extension registered with the IANA must be defined in a 543 formal Standards-Track or IESG-approved Experimental protocol 544 document. The definition must include: 546 o the textual name of the SMTP service extension; 548 o the EHLO keyword value associated with the extension; 550 o the syntax and possible values of parameters associated with the 551 EHLO keyword value; 553 o any additional SMTP verbs associated with the extension 554 (additional verbs will usually be, but are not required to be, the 555 same as the EHLO keyword value); 557 o any new parameters the extension associates with the MAIL or RCPT 558 verbs; 560 o a description of how support for the extension affects the 561 behavior of a server and client SMTP; and 563 o the increment by which the extension is increasing the maximum 564 length of the commands MAIL and/or RCPT, over that specified in 565 this Standard. 567 In addition, any EHLO keyword value starting with an upper or lower 568 case "X" refers to a local SMTP service extension used exclusively 569 through bilateral agreement. Keywords beginning with "X" MUST NOT be 570 used in a registered service extension. Conversely, keyword values 571 presented in the EHLO response that do not begin with "X" MUST 572 correspond to a Standard, Standards-Track, or IESG-approved 573 Experimental SMTP service extension registered with IANA. A 574 conforming server MUST NOT offer non-"X"-prefixed keyword values that 575 are not described in a registered extension. 577 Additional verbs and parameter names are bound by the same rules as 578 EHLO keywords; specifically, verbs beginning with "X" are local 579 extensions that may not be registered or standardized. Conversely, 580 verbs not beginning with "X" must always be registered. 582 2.2.3. Special Issues with Extensions 584 Extensions that change fairly basic properties of SMTP operation are 585 permitted. The text in other sections of this document must be 586 understood in that context. In particular, extensions can change the 587 minimum limits specified in Section 4.5.3, can change the ASCII 588 character set requirement as mentioned above, or can introduce some 589 optional modes of message handling. 591 In particular, if an extension implies that the delivery path 592 normally supports special features of that extension, and an 593 intermediate SMTP system finds a next hop that does not support the 594 required extension, it MAY choose, based on the specific extension 595 and circumstances, to requeue the message and try later and/or try an 596 alternate MX host. If this strategy is employed, the timeout to fall 597 back to an unextended format (if one is available) SHOULD be less 598 than the normal timeout for bouncing as undeliverable (e.g., if 599 normal timeout is three days, the requeue timeout before attempting 600 to transmit the mail without the extension might be one day). 602 2.3. SMTP Terminology 604 2.3.1. Mail Objects 606 SMTP transports a mail object. A mail object contains an envelope 607 and content. 609 The SMTP envelope is sent as a series of SMTP protocol units 610 (described in Section 3). It consists of an originator address (to 611 which error reports should be directed), one or more recipient 612 addresses, and optional protocol extension material. Historically, 613 variations on the reverse-path (originator) address specification 614 command (MAIL) could be used to specify alternate delivery modes, 615 such as immediate display; those variations have now been deprecated 616 (see Appendix F and Appendix F.6). 618 The SMTP content is sent in the SMTP DATA protocol unit and has two 619 parts: the header section and the body. If the content conforms to 620 other contemporary standards, the header section consists of a 621 collection of header fields, each consisting of a header name, a 622 colon, and data, structured as in the message format specification 623 (RFC 5322 [12]); the body, if structured, is defined according to 624 MIME (RFC 2045 [25]). The content is textual in nature, expressed 625 using the US-ASCII repertoire [2]. Although SMTP extensions (such as 626 "8BITMIME", RFC 6152 [47]) may relax this restriction for the content 627 body, the content header fields are always encoded using the US-ASCII 628 repertoire. Two MIME extensions (RFC 2047 [26] and RFC 2231 [29]) 629 define an algorithm for representing header values outside the US- 630 ASCII repertoire, while still encoding them using the US-ASCII 631 repertoire. 633 2.3.2. Senders and Receivers 635 In RFC 821, the two hosts participating in an SMTP transaction were 636 described as the "SMTP-sender" and "SMTP-receiver". This document 637 has been changed to reflect current industry terminology and hence 638 refers to them as the "SMTP client" (or sometimes just "the client") 639 and "SMTP server" (or just "the server"), respectively. Since a 640 given host may act both as server and client in a relay situation, 641 "receiver" and "sender" terminology is still used where needed for 642 clarity. 644 2.3.3. Mail Agents and Message Stores 646 Additional mail system terminology became common after RFC 821 was 647 published and, where convenient, is used in this specification. In 648 particular, SMTP servers and clients provide a mail transport service 649 and therefore act as "Mail Transfer Agents" (MTAs). "Mail User 650 Agents" (MUAs or UAs) are normally thought of as the sources and 651 targets of mail. At the source, an MUA might collect mail to be 652 transmitted from a user and hand it off to an MTA; the final 653 ("delivery") MTA would be thought of as handing the mail off to an 654 MUA (or at least transferring responsibility to it, e.g., by 655 depositing the message in a "message store"). However, while these 656 terms are used with at least the appearance of great precision in 657 other environments, the implied boundaries between MUAs and MTAs 658 often do not accurately match common, and conforming, practices with 659 Internet mail. Hence, the reader should be cautious about inferring 660 the strong relationships and responsibilities that might be implied 661 if these terms were used elsewhere. 663 2.3.4. Host 665 For the purposes of this specification, a host is a computer system 666 attached to the Internet (or, in some cases, to a private TCP/IP 667 network) and supporting the SMTP protocol. Hosts are known by names 668 (see the next section); they SHOULD NOT be identified by numerical 669 addresses, i.e., by address literals as described in Section 4.1.2. 671 2.3.5. Domain Names 673 A domain name (or often just a "domain") consists of one or more 674 components, separated by dots if more than one appears. In the case 675 of a top-level domain used by itself in an email address, a single 676 string is used without any dots. This makes the requirement, 677 described in more detail below, that only fully-qualified domain 678 names appear in SMTP transactions on the public Internet, 679 particularly important where top-level domains are involved. These 680 components ("labels" in DNS terminology, RFC 1035 [4]) are restricted 681 for SMTP purposes to consist of a sequence of letters, digits, and 682 hyphens drawn from the ASCII character set [2] and conforming to what 683 RFC 1035 Section 2.3.1 calls the "preferred name syntax". Domain 684 names are used as names of hosts and of other entities in the domain 685 name hierarchy. For example, a domain may refer to an alias (label 686 of a CNAME RR) or the label of Mail eXchanger records to be used to 687 deliver mail instead of representing a host name. See RFC 1035 [4] 688 and Section 5 of this specification. 690 The domain name, as described in this document and in RFC 1035 [4], 691 is the entire, fully-qualified name (often referred to as an "FQDN"). 692 A domain name that is not in FQDN form is no more than a local alias. 693 Local aliases MUST NOT appear in any SMTP transaction. 695 Only resolvable, fully-qualified domain names (FQDNs) are permitted 696 when domain names are used in SMTP. In other words, names that can 697 be resolved to MX RRs or address (i.e., A or AAAA) RRs (as discussed 698 in Section 5) are permitted, as are CNAME RRs whose targets can be 699 resolved, in turn, to MX or address RRs. 700 [[CREF4: [[5321bis Editor's Note: it is not clear whether "In other 701 words" really meant "for example" or it is was intended that the only 702 labels permitted are those that own records in one of the above RR 703 types]]]] 704 Local nicknames or unqualified names MUST NOT be used. There are two 705 exceptions to the rule requiring FQDNs: 707 o The domain name given in the EHLO command MUST be either a primary 708 host name (a domain name that resolves to an address RR) or, if 709 the host has no name, an address literal, as described in 710 Section 4.1.3 and discussed further in the EHLO discussion of 711 Section 4.1.4. 713 o The reserved mailbox name "postmaster" may be used in a RCPT 714 command without domain qualification (see Section 4.1.1.3) and 715 MUST be accepted if so used. 717 2.3.6. Buffer and State Table 719 SMTP sessions are stateful, with both parties carefully maintaining a 720 common view of the current state. In this document, we model this 721 state by a virtual "buffer" and a "state table" on the server that 722 may be used by the client to, for example, "clear the buffer" or 723 "reset the state table", causing the information in the buffer to be 724 discarded and the state to be returned to some previous state. 726 2.3.7. Commands and Replies 728 SMTP commands and, unless altered by a service extension, message 729 data, are transmitted from the sender to the receiver via the 730 transmission channel in "lines". 732 An SMTP reply is an acknowledgment (positive or negative) sent in 733 "lines" from receiver to sender via the transmission channel in 734 response to a command. The general form of a reply is a numeric 735 completion code (indicating failure or success) usually followed by a 736 text string. The codes are for use by programs and the text is 737 usually intended for human users. RFC 3463 [7], specifies further 738 structuring of the reply strings, including the use of supplemental 739 and more specific completion codes (see also RFC 5248 [46]). 741 2.3.8. Lines 743 Lines consist of zero or more data characters terminated by the 744 sequence ASCII character "CR" (hex value 0D) followed immediately by 745 ASCII character "LF" (hex value 0A). This termination sequence is 746 denoted as in this document. Conforming implementations MUST 747 NOT recognize or generate any other character or character sequence 748 as a line terminator. Limits MAY be imposed on line lengths by 749 servers (see Section 4). 751 In addition, the appearance of "bare" "CR" or "LF" characters in text 752 (i.e., either without the other) has a long history of causing 753 problems in mail implementations and applications that use the mail 754 system as a tool. SMTP client implementations MUST NOT transmit 755 these characters except when they are intended as line terminators 756 and then MUST, as indicated above, transmit them only as a 757 sequence. 759 2.3.9. Message Content and Mail Data 761 The terms "message content" and "mail data" are used interchangeably 762 in this document to describe the material transmitted after the DATA 763 command is accepted and before the end of data indication is 764 transmitted. Message content includes the message header section and 765 the possibly structured message body. In the absence of extensions, 766 both are required to be ASCII (see Section 2.3.1). The MIME 767 specification (RFC 2045 [25]) provides the standard mechanisms for 768 structured message bodies. 770 2.3.10. Originator, Delivery, Relay, and Gateway Systems 772 This specification makes a distinction among four types of SMTP 773 systems, based on the role those systems play in transmitting 774 electronic mail. An "originating" system (sometimes called an SMTP 775 originator) introduces mail into the Internet or, more generally, 776 into a transport service environment. A "delivery" SMTP system is 777 one that receives mail from a transport service environment and 778 passes it to a mail user agent or deposits it in a message store that 779 a mail user agent is expected to subsequently access. A "relay" SMTP 780 system (usually referred to just as a "relay") receives mail from an 781 SMTP client and transmits it, without modification to the message 782 data other than adding trace information, to another SMTP server for 783 further relaying or for delivery. 785 A "gateway" SMTP system (usually referred to just as a "gateway") 786 receives mail from a client system in one transport environment and 787 transmits it to a server system in another transport environment. 788 Differences in protocols or message semantics between the transport 789 environments on either side of a gateway may require that the gateway 790 system perform transformations to the message that are not permitted 791 to SMTP relay systems. For the purposes of this specification, 792 firewalls that rewrite addresses should be considered as gateways, 793 even if SMTP is used on both sides of them (see RFC 2979 [32]). 794 [[CREF5: [5321bis] [[Note in draft/Placeholder: There has been a 795 request to expand this section, possibly into a more extensive model 796 of Internet mail. Comments from others solicited. In particular, 797 does RFC 5598 make that suggestion OBE?]] ]] 799 2.3.11. Mailbox and Address 801 As used in this specification, an "address" is a character string 802 that identifies a user to whom mail will be sent or a location into 803 which mail will be deposited. The term "mailbox" refers to that 804 depository. The two terms are typically used interchangeably unless 805 the distinction between the location in which mail is placed (the 806 mailbox) and a reference to it (the address) is important. An 807 address normally consists of user and domain specifications. The 808 standard mailbox naming convention is defined to be "local- 809 part@domain"; contemporary usage permits a much broader set of 810 applications than simple "user names". Consequently, and due to a 811 long history of problems when intermediate hosts have attempted to 812 optimize transport by modifying them, the local-part MUST be 813 interpreted and assigned semantics only by the host specified in the 814 domain part of the address. 816 2.4. General Syntax Principles and Transaction Model 818 SMTP commands and replies have a rigid syntax. All commands begin 819 with a command verb. All replies begin with a three digit numeric 820 code. In some commands and replies, arguments are required following 821 the verb or reply code. Some commands do not accept arguments (after 822 the verb), and some reply codes are followed, sometimes optionally, 823 by free form text. In both cases, where text appears, it is 824 separated from the verb or reply code by a space character. Complete 825 definitions of commands and replies appear in Section 4. 827 Verbs and argument values (e.g., "TO:" or "to:" in the RCPT command 828 and extension name keywords) are not case sensitive, with the sole 829 exception in this specification of a mailbox local-part (SMTP 830 Extensions may explicitly specify case-sensitive elements). That is, 831 a command verb, an argument value other than a mailbox local-part, 832 and free form text MAY be encoded in upper case, lower case, or any 833 mixture of upper and lower case with no impact on its meaning. The 834 local-part of a mailbox MUST BE treated as case sensitive. 835 Therefore, SMTP implementations MUST take care to preserve the case 836 of mailbox local-parts. In particular, for some hosts, the user 837 "smith" is different from the user "Smith". However, exploiting the 838 case sensitivity of mailbox local-parts impedes interoperability and 839 is discouraged. Mailbox domains follow normal DNS rules and are 840 hence not case sensitive. 842 A few SMTP servers, in violation of this specification (and RFC 821) 843 require that command verbs be encoded by clients in upper case. 844 Implementations MAY wish to employ this encoding to accommodate those 845 servers. 847 The argument clause consists of a variable-length character string 848 ending with the end of the line, i.e., with the character sequence 849 . The receiver will take no action until this sequence is 850 received. 852 The syntax for each command is shown with the discussion of that 853 command. Common elements and parameters are shown in Section 4.1.2. 855 Commands and replies are composed of characters from the ASCII 856 character set [2]. When the transport service provides an 8-bit byte 857 (octet) transmission channel, each 7-bit character is transmitted, 858 right justified, in an octet with the high-order bit cleared to zero. 859 More specifically, the unextended SMTP service provides 7-bit 860 transport only. An originating SMTP client that has not successfully 861 negotiated an appropriate extension with a particular server (see the 862 next paragraph) MUST NOT transmit messages with information in the 863 high-order bit of octets. If such messages are transmitted in 864 violation of this rule, receiving SMTP servers MAY clear the high- 865 order bit or reject the message as invalid. In general, a relay SMTP 866 SHOULD assume that the message content it has received is valid and, 867 assuming that the envelope permits doing so, relay it without 868 inspecting that content. Of course, if the content is mislabeled and 869 the data path cannot accept the actual content, this may result in 870 the ultimate delivery of a severely garbled message to the recipient. 871 Delivery SMTP systems MAY reject such messages, or return them as 872 undeliverable, rather than deliver them. In the absence of a server- 873 offered extension explicitly permitting it, a sending SMTP system is 874 not permitted to send envelope commands in any character set other 875 than US-ASCII. Receiving systems SHOULD reject such commands, 876 normally using "500 syntax error - invalid character" replies. 878 8-bit message content transmission MAY be requested of the server by 879 a client using extended SMTP facilities, notably the "8BITMIME" 880 extension, RFC 6152 [47]. 8BITMIME SHOULD be supported by SMTP 881 servers. However, it MUST NOT be construed as authorization to 882 transmit unrestricted 8-bit material, nor does 8BITMIME authorize 883 transmission of any envelope material in other than ASCII. 8BITMIME 884 MUST NOT be requested by senders for material with the high bit on 885 that is not in MIME format with an appropriate content-transfer 886 encoding; servers MAY reject such messages. 888 The metalinguistic notation used in this document corresponds to the 889 "Augmented BNF" used in other Internet mail system documents. The 890 reader who is not familiar with that syntax should consult the ABNF 891 specification in RFC 5234 [11]. Metalanguage terms used in running 892 text are surrounded by pointed brackets (e.g., ) for clarity. 893 The reader is cautioned that the grammar expressed in the 894 metalanguage is not comprehensive. There are many instances in which 895 provisions in the text constrain or otherwise modify the syntax or 896 semantics implied by the grammar. 898 3. The SMTP Procedures: An Overview 900 This section contains descriptions of the procedures used in SMTP: 901 session initiation, mail transaction, forwarding mail, verifying 902 mailbox names and expanding mailing lists, and opening and closing 903 exchanges. Comments on relaying, a note on mail domains, and a 904 discussion of changing roles are included at the end of this section. 905 Several complete scenarios are presented in Appendix D. 907 3.1. Session Initiation 909 An SMTP session is initiated when a client opens a connection to a 910 server and the server responds with an opening message. 912 SMTP server implementations MAY include identification of their 913 software and version information in the connection greeting reply 914 after the 220 code, a practice that permits more efficient isolation 915 and repair of any problems. Implementations MAY make provision for 916 SMTP servers to disable the software and version announcement where 917 it causes security concerns. While some systems also identify their 918 contact point for mail problems, this is not a substitute for 919 maintaining the required "postmaster" address (see Section 4). 921 The SMTP protocol allows a server to formally reject a mail session 922 while still allowing the initial connection as follows: a 554 923 response MAY be given in the initial connection opening message 924 instead of the 220. A server taking this approach MUST still wait 925 for the client to send a QUIT (see Section 4.1.1.10) before closing 926 the connection and SHOULD respond to any intervening commands with 927 "503 bad sequence of commands". Since an attempt to make an SMTP 928 connection to such a system is probably in error, a server returning 929 a 554 response on connection opening SHOULD provide enough 930 information in the reply text to facilitate debugging of the sending 931 system. 933 3.2. Client Initiation 935 Once the server has sent the greeting (welcoming) message and the 936 client has received it, the client normally sends the EHLO command to 937 the server, indicating the client's identity. In addition to opening 938 the session, use of EHLO indicates that the client is able to process 939 service extensions and requests that the server provide a list of the 940 extensions it supports. Older SMTP systems that are unable to 941 support service extensions, and contemporary clients that do not 942 require service extensions in the mail session being initiated, MAY 943 use HELO instead of EHLO. Servers MUST NOT return the extended EHLO- 944 style response to a HELO command. For a particular connection 945 attempt, if the server returns a "command not recognized" response to 946 EHLO, the client SHOULD be able to fall back and send HELO. 948 In the EHLO command, the host sending the command identifies itself; 949 the command may be interpreted as saying "Hello, I am " (and, 950 in the case of EHLO, "and I support service extension requests"). 952 3.3. Mail Transactions 954 There are three steps to SMTP mail transactions. The transaction 955 starts with a MAIL command that gives the sender identification. (In 956 general, the MAIL command may be sent only when no mail transaction 957 is in progress; see Section 4.1.4.) A series of one or more RCPT 958 commands follows, giving the receiver information. Then, a DATA 959 command initiates transfer of the mail data and is terminated by the 960 "end of mail" data indicator, which also confirms (and terminates) 961 the transaction. 963 Mail transactions are also terminated by the RSET command 964 (Section 4.1.1.5), the sending of an EHLO command (Section 3.2), or 965 the sending of a QUIT command (Section 3.8) which terminates both any 966 active mail transaction and the SMTP connection. 968 The first step in the procedure is the MAIL command. 970 MAIL FROM: [SP ] 972 This command tells the SMTP-receiver that a new mail transaction is 973 starting and to reset all its state tables and buffers, including any 974 recipients or mail data. The portion of the first or 975 only argument contains the source mailbox (between "<" and ">" 976 brackets), which can be used to report errors (see Section 4.2 for a 977 discussion of error reporting). If accepted, the SMTP server returns 978 a "250 OK" reply. If the mailbox specification is not acceptable for 979 some reason, the server MUST return a reply indicating whether the 980 failure is permanent (i.e., will occur again if the client tries to 981 send the same address again) or temporary (i.e., the address might be 982 accepted if the client tries again later). Despite the apparent 983 scope of this requirement, there are circumstances in which the 984 acceptability of the reverse-path may not be determined until one or 985 more forward-paths (in RCPT commands) can be examined. In those 986 cases, the server MAY reasonably accept the reverse-path (with a 250 987 reply) and then report problems after the forward-paths are received 988 and examined. Normally, failures produce 550 or 553 replies. 990 Historically, the was permitted to contain more than 991 just a mailbox; however, contemporary systems SHOULD NOT use source 992 routing (see Appendix C). 994 The optional are associated with negotiated SMTP 995 service extensions (see Section 2.2). 997 The second step in the procedure is the RCPT command. This step of 998 the procedure can be repeated any number of times. 1000 RCPT TO: [ SP ] 1002 The first or only argument to this command includes a forward-path 1003 (normally a mailbox local-part and domain, always surrounded by "<" 1004 and ">" brackets) identifying one recipient. If accepted, the SMTP 1005 server returns a "250 OK" reply and stores the forward-path. If the 1006 recipient is known not to be a deliverable address, the SMTP server 1007 returns a 550 reply, typically with a string such as "no such user - 1008 " and the mailbox name (other circumstances and reply codes are 1009 possible). 1011 The can contain more than just a mailbox. 1012 Historically, the was permitted to contain a source 1013 routing list of hosts and the destination mailbox; however, 1014 contemporary SMTP clients SHOULD NOT utilize source routes (see 1015 Appendix C). Servers MUST be prepared to encounter a list of source 1016 routes in the forward-path, but they SHOULD ignore the routes or MAY 1017 decline to support the relaying they imply. Similarly, servers MAY 1018 decline to accept mail that is destined for other hosts or systems. 1019 These restrictions make a server useless as a relay for clients that 1020 do not support full SMTP functionality. Consequently, restricted- 1021 capability clients MUST NOT assume that any SMTP server on the 1022 Internet can be used as their mail processing (relaying) site. If a 1023 RCPT command appears without a previous MAIL command, the server MUST 1024 return a 503 "Bad sequence of commands" response. The optional 1025 are associated with negotiated SMTP service 1026 extensions (see Section 2.2). [[CREF6: [5321bis]: this section would 1027 be improved by being more specific about where mail transactions 1028 begin and end and then talking about "transaction state" here, rather 1029 than specific prior commands. --JcK]] 1031 Since it has been a common source of errors, it is worth noting that 1032 spaces are not permitted on either side of the colon following FROM 1033 in the MAIL command or TO in the RCPT command. The syntax is exactly 1034 as given above. 1036 The third step in the procedure is the DATA command (or some 1037 alternative specified in a service extension). 1039 DATA 1041 If accepted, the SMTP server returns a 354 Intermediate reply and 1042 considers all succeeding lines up to but not including the end of 1043 mail data indicator to be the message text. When the end of text is 1044 successfully received and stored, the SMTP-receiver sends a "250 OK" 1045 reply. 1047 Since the mail data is sent on the transmission channel, the end of 1048 mail data must be indicated so that the command and reply dialog can 1049 be resumed. SMTP indicates the end of the mail data by sending a 1050 line containing only a "." (period or full stop). A transparency 1051 procedure is used to prevent this from interfering with the user's 1052 text (see Section 4.5.2). 1054 The end of mail data indicator also confirms the mail transaction and 1055 tells the SMTP server to now process the stored recipients and mail 1056 data. If accepted, the SMTP server returns a "250 OK" reply. The 1057 DATA command can fail at only two points in the protocol exchange: 1059 If there was no MAIL, or no RCPT, command, or all such commands were 1060 rejected, the server MAY return a "command out of sequence" (503) or 1061 "no valid recipients" (554) reply in response to the DATA command. 1062 If one of those replies (or any other 5yz reply) is received, the 1063 client MUST NOT send the message data; more generally, message data 1064 MUST NOT be sent unless a 354 reply is received. 1066 If the verb is initially accepted and the 354 reply issued, the DATA 1067 command should fail only if the mail transaction was incomplete (for 1068 example, no recipients), if resources were unavailable (including, of 1069 course, the server unexpectedly becoming unavailable), or if the 1070 server determines that the message should be rejected for policy or 1071 other reasons. 1073 However, in practice, some servers do not perform recipient 1074 verification until after the message text is received. These servers 1075 SHOULD treat a failure for one or more recipients as a "subsequent 1076 failure" and return a mail message as discussed in Section 6 and, in 1077 particular, in Section 6.1. Using a "550 mailbox not found" (or 1078 equivalent) reply code after the data are accepted makes it difficult 1079 or impossible for the client to determine which recipients failed. 1081 When the RFC 822 format ([13], [12]) is being used, the mail data 1082 include the header fields such as those named Date, Subject, To, Cc, 1083 and From. Server SMTP systems SHOULD NOT reject messages based on 1084 perceived defects in the RFC 822 or MIME (RFC 2045 [25]) message 1085 header section or message body. In particular, they MUST NOT reject 1086 messages in which the numbers of Resent-header fields do not match or 1087 Resent-to appears without Resent-from and/or Resent-date. 1089 Mail transaction commands MUST be used in the order discussed above. 1091 3.4. Forwarding for Address Correction or Updating 1093 Forwarding support is most often required to consolidate and simplify 1094 addresses within, or relative to, some enterprise and less frequently 1095 to establish addresses to link a person's prior address with a 1096 current one. Silent forwarding of messages (without server 1097 notification to the sender), for security or non-disclosure purposes, 1098 is common in the contemporary Internet. 1100 In both the enterprise and the "new address" cases, information 1101 hiding (and sometimes security) considerations argue against exposure 1102 of the "final" address through the SMTP protocol as a side effect of 1103 the forwarding activity. This may be especially important when the 1104 final address may not even be reachable by the sender. Consequently, 1105 the "forwarding" mechanisms described in Section 3.2 of RFC 821, and 1106 especially the 251 (corrected destination) and 551 reply codes from 1107 RCPT must be evaluated carefully by implementers and, when they are 1108 available, by those configuring systems (see also Section 7.4). 1110 In particular: 1112 o Servers MAY forward messages when they are aware of an address 1113 change. When they do so, they MAY either provide address-updating 1114 information with a 251 code, or may forward "silently" and return 1115 a 250 code. However, if a 251 code is used, they MUST NOT assume 1116 that the client will actually update address information or even 1117 return that information to the user. 1119 Alternately, 1121 o Servers MAY reject messages or return them as non-deliverable when 1122 they cannot be delivered precisely as addressed. When they do so, 1123 they MAY either provide address-updating information with a 551 1124 code, or may reject the message as undeliverable with a 550 code 1125 and no address-specific information. However, if a 551 code is 1126 used, they MUST NOT assume that the client will actually update 1127 address information or even return that information to the user. 1129 SMTP server implementations that support the 251 and/or 551 reply 1130 codes SHOULD provide configuration mechanisms so that sites that 1131 conclude that they would undesirably disclose information can disable 1132 or restrict their use. 1134 3.5. Commands for Debugging Addresses 1135 3.5.1. Overview 1137 SMTP provides commands to verify a user name or obtain the content of 1138 a mailing list. This is done with the VRFY and EXPN commands, which 1139 have character string arguments. Implementations SHOULD support VRFY 1140 and EXPN (however, see Section 3.5.2 and Section 7.3). 1142 For the VRFY command, the string is a user name or a user name and 1143 domain (see below). If a normal (i.e., 250) response is returned, 1144 the response MAY include the full name of the user and MUST include 1145 the mailbox of the user. It MUST be in either of the following 1146 forms: 1148 User Name 1149 local-part@domain 1151 When a name that is the argument to VRFY could identify more than one 1152 mailbox, the server MAY either note the ambiguity or identify the 1153 alternatives. In other words, any of the following are legitimate 1154 responses to VRFY: 1156 553 User ambiguous 1158 or 1160 553- Ambiguous; Possibilities are 1161 553-Joe Smith 1162 553-Harry Smith 1163 553 Melvin Smith 1165 or 1167 553-Ambiguous; Possibilities 1168 553- 1169 553- 1170 553 1172 Under normal circumstances, a client receiving a 553 reply would be 1173 expected to expose the result to the user. Use of exactly the forms 1174 given, and the "user ambiguous" or "ambiguous" keywords, possibly 1175 supplemented by extended reply codes, such as those described in RFC 1176 3463 [7], will facilitate automated translation into other languages 1177 as needed. Of course, a client that was highly automated or that was 1178 operating in another language than English might choose to try to 1179 translate the response to return some other indication to the user 1180 than the literal text of the reply, or to take some automated action 1181 such as consulting a directory service for additional information 1182 before reporting to the user. 1184 For the EXPN command, the string identifies a mailing list, and the 1185 successful (i.e., 250) multiline response MAY include the full name 1186 of the users and MUST give the mailboxes on the mailing list. 1188 In some hosts, the distinction between a mailing list and an alias 1189 for a single mailbox is a bit fuzzy, since a common data structure 1190 may hold both types of entries, and it is possible to have mailing 1191 lists containing only one mailbox. If a request is made to apply 1192 VRFY to a mailing list, a positive response MAY be given if a message 1193 so addressed would be delivered to everyone on the list, otherwise an 1194 error SHOULD be reported (e.g., "550 That is a mailing list, not a 1195 user" or "252 Unable to verify members of mailing list"). If a 1196 request is made to expand a user name, the server MAY return a 1197 positive response consisting of a list containing one name, or an 1198 error MAY be reported (e.g., "550 That is a user name, not a mailing 1199 list"). 1201 In the case of a successful multiline reply (normal for EXPN), 1202 exactly one mailbox is to be specified on each line of the reply. 1203 The case of an ambiguous request is discussed above. 1205 "User name" is a fuzzy term and has been used deliberately. An 1206 implementation of the VRFY or EXPN commands MUST include at least 1207 recognition of local mailboxes as "user names". However, since 1208 current Internet practice often results in a single host handling 1209 mail for multiple domains, hosts, especially hosts that provide this 1210 functionality, SHOULD accept the "local-part@domain" form as a "user 1211 name"; hosts MAY also choose to recognize other strings as "user 1212 names". 1214 The case of expanding a mailbox list requires a multiline reply, such 1215 as: 1217 C: EXPN Example-People 1218 S: 250-Jon Postel 1219 S: 250-Fred Fonebone 1220 S: 250 Sam Q. Smith 1222 or 1224 C: EXPN Executive-Washroom-List 1225 S: 550 Access Denied to You. 1227 The character string arguments of the VRFY and EXPN commands cannot 1228 be further restricted due to the variety of implementations of the 1229 user name and mailbox list concepts. On some systems, it may be 1230 appropriate for the argument of the EXPN command to be a file name 1231 for a file containing a mailing list, but again there are a variety 1232 of file naming conventions in the Internet. Similarly, historical 1233 variations in what is returned by these commands are such that the 1234 response SHOULD be interpreted very carefully, if at all, and SHOULD 1235 generally only be used for diagnostic purposes. 1237 3.5.2. VRFY Normal Response 1239 When normal (2yz or 551) responses are returned from a VRFY or EXPN 1240 request, the reply MUST include the name using a "" construction, where "domain" is a fully-qualified 1242 domain name. In circumstances exceptional enough to justify 1243 violating the intent of this specification, free-form text MAY be 1244 returned. In order to facilitate parsing by both computers and 1245 people, addresses SHOULD appear in pointed brackets. When addresses, 1246 rather than free-form debugging information, are returned, EXPN and 1247 VRFY MUST return only valid domain addresses that are usable in SMTP 1248 RCPT commands. Consequently, if an address implies delivery to a 1249 program or other system, the mailbox name used to reach that target 1250 MUST be given. Paths (explicit source routes) MUST NOT be returned 1251 by VRFY or EXPN. 1253 Server implementations SHOULD support both VRFY and EXPN. For 1254 security reasons, implementations MAY provide local installations a 1255 way to disable either or both of these commands through configuration 1256 options or the equivalent (see Section 7.3). When these commands are 1257 supported, they are not required to work across relays when relaying 1258 is supported. Since they were both optional in RFC 821, but VRFY was 1259 made mandatory in RFC 1123 [5], if EXPN is supported, it MUST be 1260 listed as a service extension in an EHLO response. VRFY MAY be 1261 listed as a convenience but, since support for it is required, SMTP 1262 clients are not required to check for its presence on the extension 1263 list before using it. 1265 3.5.3. Meaning of VRFY or EXPN Success Response 1267 A server MUST NOT return a 250 code in response to a VRFY or EXPN 1268 command unless it has actually verified the address. In particular, 1269 a server MUST NOT return 250 if all it has done is to verify that the 1270 syntax given is valid. In that case, 502 (Command not implemented) 1271 or 500 (Syntax error, command unrecognized) SHOULD be returned. As 1272 stated elsewhere, implementation (in the sense of actually validating 1273 addresses and returning information) of VRFY and EXPN are strongly 1274 recommended. Hence, implementations that return 500 or 502 for VRFY 1275 are not in full compliance with this specification. 1277 There may be circumstances where an address appears to be valid but 1278 cannot reasonably be verified in real time, particularly when a 1279 server is acting as a mail exchanger for another server or domain. 1281 "Apparent validity", in this case, would normally involve at least 1282 syntax checking and might involve verification that any domains 1283 specified were ones to which the host expected to be able to relay 1284 mail. In these situations, reply code 252 SHOULD be returned. These 1285 cases parallel the discussion of RCPT verification in Section 2.1. 1286 Similarly, the discussion in Section 3.4 applies to the use of reply 1287 codes 251 and 551 with VRFY (and EXPN) to indicate addresses that are 1288 recognized but that would be forwarded or rejected were mail received 1289 for them. Implementations generally SHOULD be more aggressive about 1290 address verification in the case of VRFY than in the case of RCPT, 1291 even if it takes a little longer to do so. 1293 3.5.4. Semantics and Applications of EXPN 1295 EXPN is often very useful in debugging and understanding problems 1296 with mailing lists and multiple-target-address aliases. Some systems 1297 have attempted to use source expansion of mailing lists as a means of 1298 eliminating duplicates. The propagation of aliasing systems with 1299 mail on the Internet for hosts (typically with MX and CNAME DNS 1300 records), for mailboxes (various types of local host aliases), and in 1301 various proxying arrangements has made it nearly impossible for these 1302 strategies to work consistently, and mail systems SHOULD NOT attempt 1303 them. 1305 3.6. Relaying and Mail Routing 1307 3.6.1. Source Routes and Relaying 1309 In general, the availability of Mail eXchanger records in the domain 1310 name system (RFC 1035 [4], RFC 974 [16]) makes the use of explicit 1311 source routes in the Internet mail system unnecessary. Many 1312 historical problems with the interpretation of explicit source routes 1313 have made their use undesirable. SMTP clients SHOULD NOT generate 1314 explicit source routes except under unusual circumstances. SMTP 1315 servers MAY decline to act as mail relays or to accept addresses that 1316 specify source routes. When route information is encountered, SMTP 1317 servers MAY ignore the route information and simply send to the final 1318 destination specified as the last element in the route and SHOULD do 1319 so. There has been an invalid practice of using names that do not 1320 appear in the DNS as destination names, with the senders counting on 1321 the intermediate hosts specified in source routing to resolve any 1322 problems. If source routes are stripped, this practice will cause 1323 failures. This is one of several reasons why SMTP clients MUST NOT 1324 generate invalid source routes or depend on serial resolution of 1325 names in such routes. 1327 When source routes are not used, the process described in RFC 821 for 1328 constructing a reverse-path from the forward-path is not applicable 1329 and the reverse-path at the time of delivery will simply be the 1330 address that appeared in the MAIL command. 1332 3.6.2. Mail eXchange Records and Relaying 1334 A relay SMTP server is usually the target of a DNS MX record that 1335 designates it, rather than the final delivery system. The relay 1336 server may accept or reject the task of relaying the mail in the same 1337 way it accepts or rejects mail for a local user. If it accepts the 1338 task, it then becomes an SMTP client, establishes a transmission 1339 channel to the next SMTP server specified in the DNS (according to 1340 the rules in Section 5), and sends it the mail. If it declines to 1341 relay mail to a particular address for policy reasons, a 550 response 1342 SHOULD be returned. 1344 [[CREF7: Proposed replacement for next paragraph (D Crocker 1345 2021-03-17 17:23 email), Cf. Ticket #30: This specification does not 1346 deal with the verification of a return path. Server efforts to 1347 verify a return path are outside the scope of this specification.]] 1349 This specification does not deal with the verification of return 1350 paths for use in delivery notifications. Recent work, such as that 1351 on SPF [41] and DKIM [43] [44], has been done to provide ways to 1352 ascertain that an address is valid or belongs to the person who 1353 actually sent the message. A server MAY attempt to verify the return 1354 path before using its address for delivery notifications, but methods 1355 of doing so are not defined here nor is any particular method 1356 recommended at this time. 1357 [[5321bis Editor's Note: Proposed erratum (4055) suggests that DKIM 1358 and SPF have nothing to do with this and that everything after the 1359 first sentence in the paragraph above should be dropped. An 1360 alternative would be to tune the texts. ???]] 1362 3.6.3. Message Submission Servers as Relays 1364 Many mail-sending clients exist, especially in conjunction with 1365 facilities that receive mail via POP3 or IMAP, that have limited 1366 capability to support some of the requirements of this specification, 1367 such as the ability to queue messages for subsequent delivery 1368 attempts. For these clients, it is common practice to make private 1369 arrangements to send all messages to a single server for processing 1370 and subsequent distribution. SMTP, as specified here, is not ideally 1371 suited for this role. A standardized mail submission protocol has 1372 been developed that is gradually superseding practices based on SMTP 1373 (see RFC 6409 [42]). In any event, because these arrangements are 1374 private and fall outside the scope of this specification, they are 1375 not described here. 1377 It is important to note that MX records can point to SMTP servers 1378 that act as gateways into other environments, not just SMTP relays 1379 and final delivery systems; see Sections 3.7 and 5. 1381 If an SMTP server has accepted the task of relaying the mail and 1382 later finds that the destination is incorrect or that the mail cannot 1383 be delivered for some other reason, then it MUST construct an 1384 "undeliverable mail" notification message and send it to the 1385 originator of the undeliverable mail (as indicated by the reverse- 1386 path). Formats specified for non-delivery reports by other standards 1387 (see, for example, RFC 3461 [34] and RFC 3464 [35]) SHOULD be used if 1388 possible. 1390 This notification message must be from the SMTP server at the relay 1391 host or the host that first determines that delivery cannot be 1392 accomplished. Of course, SMTP servers MUST NOT send notification 1393 messages about problems transporting notification messages. One way 1394 to prevent loops in error reporting is to specify a null reverse-path 1395 in the MAIL command of a notification message. When such a message 1396 is transmitted, the reverse-path MUST be set to null (see 1397 Section 4.5.5 for additional discussion). A MAIL command with a null 1398 reverse-path appears as follows: 1400 MAIL FROM:<> 1402 As discussed in Section 6.4, a relay SMTP has no need to inspect or 1403 act upon the header section or body of the message data and MUST NOT 1404 do so except to add its own "Received:" header field (Section 4.4) 1405 and, optionally, to attempt to detect looping in the mail system (see 1406 Section 6.3). Of course, this prohibition also applies to any 1407 modifications of these header fields or text (see also Section 7.9). 1409 3.7. Mail Gatewaying 1411 While the relay function discussed above operates within the Internet 1412 SMTP transport service environment, MX records or various forms of 1413 explicit routing may require that an intermediate SMTP server perform 1414 a translation function between one transport service and another. As 1415 discussed in Section 2.3.10, when such a system is at the boundary 1416 between two transport service environments, we refer to it as a 1417 "gateway" or "gateway SMTP". 1419 Gatewaying mail between different mail environments, such as 1420 different mail formats and protocols, is complex and does not easily 1421 yield to standardization. However, some general requirements may be 1422 given for a gateway between the Internet and another mail 1423 environment. 1425 3.7.1. Header Fields in Gatewaying 1427 Header fields MAY be rewritten when necessary as messages are 1428 gatewayed across mail environment boundaries. This may involve 1429 inspecting the message body or interpreting the local-part of the 1430 destination address in spite of the prohibitions in Section 6.4. 1432 Other mail systems gatewayed to the Internet often use a subset of 1433 the RFC 822 header section or provide similar functionality with a 1434 different syntax, but some of these mail systems do not have an 1435 equivalent to the SMTP envelope. Therefore, when a message leaves 1436 the Internet environment, it may be necessary to fold the SMTP 1437 envelope information into the message header section. A possible 1438 solution would be to create new header fields to carry the envelope 1439 information (e.g., "X-SMTP-MAIL:" and "X-SMTP-RCPT:"); however, this 1440 would require changes in mail programs in foreign environments and 1441 might risk disclosure of private information (see Section 7.2). 1443 3.7.2. Received Lines in Gatewaying 1445 When forwarding a message into or out of the Internet environment, a 1446 gateway MUST prepend a Received: line, but it MUST NOT alter in any 1447 way a Received: line that is already in the header section. 1449 "Received:" header fields of messages originating from other 1450 environments may not conform exactly to this specification. However, 1451 the most important use of Received: lines is for debugging mail 1452 faults, and this debugging can be severely hampered by well-meaning 1453 gateways that try to "fix" a Received: line. As another consequence 1454 of trace header fields arising in non-SMTP environments, receiving 1455 systems MUST NOT reject mail based on the format of a trace header 1456 field and SHOULD be extremely robust in the light of unexpected 1457 information or formats in those header fields. 1459 The gateway SHOULD indicate the environment and protocol in the "via" 1460 clauses of Received header field(s) that it supplies. 1462 3.7.3. Addresses in Gatewaying 1464 From the Internet side, the gateway SHOULD accept all valid address 1465 formats in SMTP commands and in the RFC 822 header section, and all 1466 valid RFC 822 messages. Addresses and header fields generated by 1467 gateways MUST conform to applicable standards (including this one and 1468 RFC 5322 [12]). Gateways are, of course, subject to the same rules 1469 for handling source routes as those described for other SMTP systems 1470 in Section 3.3. 1472 3.7.4. Other Header Fields in Gatewaying 1474 The gateway MUST ensure that all header fields of a message that it 1475 forwards into the Internet mail environment meet the requirements for 1476 Internet mail. In particular, all addresses in "From:", "To:", 1477 "Cc:", etc., header fields MUST be transformed (if necessary) to 1478 satisfy the standard header syntax of RFC 5322 [12], MUST reference 1479 only fully-qualified domain names, and MUST be effective and useful 1480 for sending replies. The translation algorithm used to convert mail 1481 from the Internet protocols to another environment's protocol SHOULD 1482 ensure that error messages from the foreign mail environment are 1483 delivered to the reverse-path from the SMTP envelope, not to an 1484 address in the "From:", "Sender:", or similar header fields of the 1485 message. 1487 3.7.5. Envelopes in Gatewaying 1489 Similarly, when forwarding a message from another environment into 1490 the Internet, the gateway SHOULD set the envelope return path in 1491 accordance with an error message return address, if supplied by the 1492 foreign environment. If the foreign environment has no equivalent 1493 concept, the gateway must select and use a best approximation, with 1494 the message originator's address as the default of last resort. 1496 3.8. Terminating Sessions and Connections 1498 An SMTP connection is terminated when the client sends a QUIT 1499 command. The server responds with a positive reply code, after which 1500 it closes the connection. 1502 An SMTP server MUST NOT intentionally close the connection under 1503 normal operational circumstances (see Section 7.8) except: 1505 o After receiving a QUIT command and responding with a 221 reply. 1507 o After detecting the need to shut down the SMTP service and 1508 returning a 421 reply code. This reply code can be issued after 1509 the server receives any command or, if necessary, asynchronously 1510 from command receipt (on the assumption that the client will 1511 receive it after the next command is issued). 1513 o After a timeout, as specified in Section 4.5.3.2, occurs waiting 1514 for the client to send a command or data. 1516 In particular, a server that closes connections in response to 1517 commands that are not understood is in violation of this 1518 specification. Servers are expected to be tolerant of unknown 1519 commands, issuing a 500 reply and awaiting further instructions from 1520 the client. 1522 An SMTP server that is forcibly shut down via external means SHOULD 1523 attempt to send a line containing a 421 reply code to the SMTP client 1524 before exiting. The SMTP client will normally read the 421 reply 1525 code after sending its next command. 1527 SMTP clients that experience a connection close, reset, or other 1528 communications failure due to circumstances not under their control 1529 (in violation of the intent of this specification but sometimes 1530 unavoidable) SHOULD, to maintain the robustness of the mail system, 1531 treat the mail transaction as if a 421 response had been received and 1532 act accordingly. 1534 There are circumstances, contrary to the intent of this 1535 specification, in which an SMTP server may receive an indication that 1536 the underlying TCP connection has been closed or reset. To preserve 1537 the robustness of the mail system, SMTP servers SHOULD be prepared 1538 for this condition and SHOULD treat it as if a QUIT had been received 1539 before the connection disappeared. 1541 3.9. Mailing Lists and Aliases 1543 [[CREF8: [5321bis] If "alias and list models" are explained 1544 elsewhere, cross reference". Also note that this section appears to 1545 prohibit an exploder from adding List-* headers. That needs to be 1546 finessed.]] 1547 An SMTP-capable host SHOULD support both the alias and the list 1548 models of address expansion for multiple delivery. When a message is 1549 delivered or forwarded to each address of an expanded list form, the 1550 return address in the envelope ("MAIL FROM:") MUST be changed to be 1551 the address of a person or other entity who administers the list. 1552 However, in this case, the message header section (RFC 5322 [12]) 1553 MUST be left unchanged; in particular, the "From" field of the header 1554 section is unaffected. 1556 An important mail facility is a mechanism for multi-destination 1557 delivery of a single message, by transforming (or "expanding" or 1558 "exploding") a pseudo-mailbox address into a list of destination 1559 mailbox addresses. When a message is sent to such a pseudo-mailbox 1560 (sometimes called an "exploder"), copies are forwarded or 1561 redistributed to each mailbox in the expanded list. Servers SHOULD 1562 simply utilize the addresses on the list; application of heuristics 1563 or other matching rules to eliminate some addresses, such as that of 1564 the originator, is strongly discouraged. We classify such a pseudo- 1565 mailbox as an "alias" or a "list", depending upon the expansion 1566 rules. 1568 3.9.1. Alias 1570 To expand an alias, the recipient mailer simply replaces the pseudo- 1571 mailbox address in the envelope with each of the expanded addresses 1572 in turn; the rest of the envelope and the message body are left 1573 unchanged. The message is then delivered or forwarded to each 1574 expanded address. 1576 3.9.2. List 1578 A mailing list may be said to operate by "redistribution" rather than 1579 by "forwarding". To expand a list, the recipient mailer replaces the 1580 pseudo-mailbox address in the envelope with each of the expanded 1581 addresses in turn. The return (backward-pointing) address in the 1582 envelope is changed so that all error messages generated by the final 1583 deliveries will be returned to a list administrator, not to the 1584 message originator, who generally has no control over the contents of 1585 the list and will typically find error messages annoying. Note that 1586 the key difference between handling aliases (Section 3.9.1) and 1587 forwarding (this subsection) is the change to the backward-pointing 1588 address in this case. When a list constrains its processing to the 1589 very limited set of modifications and actions described here, it is 1590 attempting to emulate an MTA; such lists can be treated as a 1591 continuation in email transit. 1593 There exist mailing lists that perform additional, sometimes 1594 extensive, modifications to a message and its envelope. Such mailing 1595 lists need to be viewed as full MUAs, which accept a delivery and 1596 post a new message. 1598 4. The SMTP Specifications 1600 4.1. SMTP Commands 1602 4.1.1. Command Semantics and Syntax 1604 The SMTP commands define the mail transfer or the mail system 1605 function requested by the user. SMTP commands are character strings 1606 terminated by . The commands themselves are alphabetic 1607 characters terminated by if parameters follow and 1608 otherwise. (In the interest of improved interoperability, SMTP 1609 receivers SHOULD tolerate trailing white space before the terminating 1610 .) The syntax of the local part of a mailbox MUST conform to 1611 receiver site conventions and the syntax specified in Section 4.1.2. 1612 The SMTP commands are discussed below. The SMTP replies are 1613 discussed in Section 4.2. 1615 A mail transaction involves several data objects that are 1616 communicated as arguments to different commands. The reverse-path is 1617 the argument of the MAIL command, the forward-path is the argument of 1618 the RCPT command, and the mail data is the argument of the DATA 1619 command. These arguments or data objects must be transmitted and 1620 held, pending the confirmation communicated by the end of mail data 1621 indication that finalizes the transaction. The model for this is 1622 that distinct buffers are provided to hold the types of data objects; 1623 that is, there is a reverse-path buffer, a forward-path buffer, and a 1624 mail data buffer. Specific commands cause information to be appended 1625 to a specific buffer, or cause one or more buffers to be cleared. 1627 Several commands (RSET, DATA, QUIT) are specified as not permitting 1628 parameters. In the absence of specific extensions offered by the 1629 server and accepted by the client, clients MUST NOT send such 1630 parameters and servers SHOULD reject commands containing them as 1631 having invalid syntax. 1633 4.1.1.1. Extended HELLO (EHLO) or HELLO (HELO) 1635 These commands are used to identify the SMTP client to the SMTP 1636 server. The argument clause contains the fully-qualified domain name 1637 of the SMTP client, if one is available. In situations in which the 1638 SMTP client system does not have a meaningful domain name (e.g., when 1639 its address is dynamically allocated and no reverse mapping record is 1640 available), the client SHOULD send an address literal (see 1641 Section 4.1.3). 1643 RFC 2821, and some earlier informal practices, encouraged following 1644 the literal by information that would help to identify the client 1645 system. That convention was not widely supported, and many SMTP 1646 servers considered it an error. In the interest of interoperability, 1647 it is probably wise for servers to be prepared for this string to 1648 occur, but SMTP clients SHOULD NOT send it. 1650 The SMTP server identifies itself to the SMTP client in the 1651 connection greeting reply and in the response to this command. 1653 A client SMTP SHOULD start an SMTP session by issuing the EHLO 1654 command. If the SMTP server supports the SMTP service extensions, it 1655 will give a successful response, a failure response, or an error 1656 response. If the SMTP server, in violation of this specification, 1657 does not support any SMTP service extensions, it will generate an 1658 error response. Older client SMTP systems MAY, as discussed above, 1659 use HELO (as specified in RFC 821) instead of EHLO, and servers MUST 1660 support the HELO command and reply properly to it. In any event, a 1661 client MUST issue HELO or EHLO before starting a mail transaction. 1663 These commands, and a "250 OK" reply to one of them, confirm that 1664 both the SMTP client and the SMTP server are in the initial state, 1665 that is, there is no transaction in progress and all state tables and 1666 buffers are cleared. 1668 Syntax: 1670 ehlo = "EHLO" SP ( Domain / address-literal ) CRLF 1672 helo = "HELO" SP Domain CRLF 1674 Normally, the response to EHLO will be a multiline reply. Each line 1675 of the response contains a keyword and, optionally, one or more 1676 parameters. Following the normal syntax for multiline replies, these 1677 keywords follow the code (250) and a hyphen for all but the last 1678 line, and the code and a space for the last line. The syntax for a 1679 positive response, using the ABNF notation and terminal symbols of 1680 RFC 5234 [11], is: 1682 ehlo-ok-rsp = ( "250" SP Domain [ SP ehlo-greet ] CRLF ) 1683 / ( "250-" Domain [ SP ehlo-greet ] CRLF 1684 *( "250-" ehlo-line CRLF ) 1685 "250" SP ehlo-line CRLF ) 1687 ehlo-greet = 1*(%d0-9 / %d11-12 / %d14-127) 1688 ; string of any characters other than CR or LF 1690 ehlo-line = ehlo-keyword *( SP ehlo-param ) 1692 ehlo-keyword = (ALPHA / DIGIT) *(ALPHA / DIGIT / "-") 1693 ; additional syntax of ehlo-params depends on 1694 ; ehlo-keyword 1696 ehlo-param = 1*(%d33-126) 1697 ; any CHAR excluding and all 1698 ; control characters (US-ASCII 0-31 and 127 1699 ; inclusive) 1701 Although EHLO keywords may be specified in upper, lower, or mixed 1702 case, they MUST always be recognized and processed in a case- 1703 insensitive manner. This is simply an extension of practices 1704 specified in RFC 821 and Section 2.4. 1706 The EHLO response MUST contain keywords (and associated parameters if 1707 required) for all commands not listed as "required" in Section 4.5.1 1708 excepting only private-use commands as described in Section 4.1.5. 1709 Private-use commands MAY be listed. 1711 4.1.1.2. MAIL (MAIL) 1713 This command is used to initiate a mail transaction in which the mail 1714 data is delivered to an SMTP server that may, in turn, deliver it to 1715 one or more mailboxes or pass it on to another system (possibly using 1716 SMTP). The argument clause contains a reverse-path and may contain 1717 optional parameters. In general, the MAIL command may be sent only 1718 when no mail transaction is in progress, see Section 4.1.4. 1720 The reverse-path consists of the sender mailbox. Historically, that 1721 mailbox might optionally have been preceded by a list of hosts, but 1722 that behavior is now deprecated (see Appendix C). In some types of 1723 reporting messages for which a reply is likely to cause a mail loop 1724 (for example, mail delivery and non-delivery notifications), the 1725 reverse-path may be null (see Section 3.6). 1727 This command clears the reverse-path buffer, the forward-path buffer, 1728 and the mail data buffer, and it inserts the reverse-path information 1729 from its argument clause into the reverse-path buffer. 1731 If service extensions were negotiated, the MAIL command may also 1732 carry parameters associated with a particular service extension. 1734 Syntax: 1736 mail = "MAIL FROM:" Reverse-path 1737 [SP Mail-parameters] CRLF 1739 4.1.1.3. RECIPIENT (RCPT) 1741 This command is used to identify an individual recipient of the mail 1742 data; multiple recipients are specified by multiple uses of this 1743 command. The argument clause contains a forward-path and may contain 1744 optional parameters. 1746 The forward-path normally consists of the required destination 1747 mailbox. Sending systems SHOULD NOT generate the optional list of 1748 hosts known as a source route. Receiving systems MUST recognize 1749 source route syntax but SHOULD strip off the source route 1750 specification and utilize the domain name associated with the mailbox 1751 as if the source route had not been provided. 1753 Similarly, relay hosts SHOULD strip or ignore source routes, and 1754 names MUST NOT be copied into the reverse-path. When mail reaches 1755 its ultimate destination (the forward-path contains only a 1756 destination mailbox), the SMTP server inserts it into the destination 1757 mailbox in accordance with its host mail conventions. 1759 This command appends its forward-path argument to the forward-path 1760 buffer; it does not change the reverse-path buffer nor the mail data 1761 buffer. 1763 For example, mail received at relay host xyz.com with envelope 1764 commands 1766 MAIL FROM: 1767 RCPT TO:<@hosta.int,@jkl.org:userc@d.bar.org> 1769 will normally be sent directly on to host d.bar.org with envelope 1770 commands 1772 MAIL FROM: 1773 RCPT TO: 1775 As provided in Appendix C, xyz.com MAY also choose to relay the 1776 message to hosta.int, using the envelope commands 1778 MAIL FROM: 1779 RCPT TO:<@hosta.int,@jkl.org:userc@d.bar.org> 1781 or to jkl.org, using the envelope commands 1783 MAIL FROM: 1784 RCPT TO:<@jkl.org:userc@d.bar.org> 1786 Attempting to use relaying this way is now strongly discouraged. 1787 Since hosts are not required to relay mail at all, xyz.com MAY also 1788 reject the message entirely when the RCPT command is received, using 1789 a 550 code (since this is a "policy reason"). 1791 If service extensions were negotiated, the RCPT command may also 1792 carry parameters associated with a particular service extension 1793 offered by the server. The client MUST NOT transmit parameters other 1794 than those associated with a service extension offered by the server 1795 in its EHLO response. 1797 Syntax: 1799 rcpt = "RCPT TO:" ( "" / "" / 1800 Forward-path ) [SP Rcpt-parameters] CRLF 1802 Note that, in a departure from the usual rules for 1803 local-parts, the "Postmaster" string shown above is 1804 treated as case-insensitive. 1806 4.1.1.4. DATA (DATA) 1808 The receiver normally sends a 354 response to DATA, and then treats 1809 the lines (strings ending in sequences, as described in 1810 Section 2.3.7) following the command as mail data from the sender. 1811 This command causes the mail data to be appended to the mail data 1812 buffer. The mail data may contain any of the 128 ASCII character 1813 codes, although experience has indicated that use of control 1814 characters other than SP, HT, CR, and LF may cause problems and 1815 SHOULD be avoided when possible. 1817 The mail data are terminated by a line containing only a period, that 1818 is, the character sequence ".", where the first is 1819 actually the terminator of the previous line (see Section 4.5.2). 1820 This is the end of mail data indication. The first of this 1821 terminating sequence is also the that ends the final line of 1822 the data (message text) or, if there was no mail data, ends the DATA 1823 command itself (the "no mail data" case does not conform to this 1824 specification since it would require that neither the trace header 1825 fields required by this specification nor the message header section 1826 required by RFC 5322 [12] be transmitted). An extra MUST NOT 1827 be added, as that would cause an empty line to be added to the 1828 message. The only exception to this rule would arise if the message 1829 body were passed to the originating SMTP-sender with a final "line" 1830 that did not end in ; in that case, the originating SMTP system 1831 MUST either reject the message as invalid or add in order to 1832 have the receiving SMTP server recognize the "end of data" condition. 1834 The custom of accepting lines ending only in , as a concession to 1835 non-conforming behavior on the part of some UNIX systems, has proven 1836 to cause more interoperability problems than it solves, and SMTP 1837 server systems MUST NOT do this, even in the name of improved 1838 robustness. In particular, the sequence "." (bare line 1839 feeds, without carriage returns) MUST NOT be treated as equivalent to 1840 . as the end of mail data indication. 1842 Receipt of the end of mail data indication requires the server to 1843 process the stored mail transaction information. This processing 1844 consumes the information in the reverse-path buffer, the forward-path 1845 buffer, and the mail data buffer, and on the completion of this 1846 command these buffers are cleared. If the processing is successful, 1847 the receiver MUST send an OK reply. If the processing fails, the 1848 receiver MUST send a failure reply. The SMTP model does not allow 1849 for partial failures at this point: either the message is accepted by 1850 the server for delivery and a positive response is returned or it is 1851 not accepted and a failure reply is returned. In sending a positive 1852 "250 OK" completion reply to the end of data indication, the receiver 1853 takes full responsibility for the message (see Section 6.1). Errors 1854 that are diagnosed subsequently MUST be reported in a mail message, 1855 as discussed in Section 4.4. 1857 When the SMTP server accepts a message either for relaying or for 1858 final delivery, it inserts a trace record (also referred to 1859 interchangeably as a "time stamp line" or "Received" line) at the top 1860 of the mail data. This trace record indicates the identity of the 1861 host that sent the message, the identity of the host that received 1862 the message (and is inserting this time stamp), and the date and time 1863 the message was received. Relayed messages will have multiple time 1864 stamp lines. Details for formation of these lines, including their 1865 syntax, is specified in Section 4.4. 1867 Additional discussion about the operation of the DATA command appears 1868 in Section 3.3. 1870 Syntax: 1872 data = "DATA" CRLF 1874 4.1.1.5. RESET (RSET) 1876 This command specifies that the current mail transaction will be 1877 aborted. Any stored sender, recipients, and mail data MUST be 1878 discarded, and all buffers and state tables cleared. The receiver 1879 MUST send a "250 OK" reply to a RSET command with no arguments. A 1880 reset command may be issued by the client at any time. It is 1881 effectively equivalent to a NOOP (i.e., it has no effect) if issued 1882 immediately after EHLO, before EHLO is issued in the session, after 1883 an end of data indicator has been sent and acknowledged, or 1884 immediately before a QUIT. An SMTP server MUST NOT close the 1885 connection as the result of receiving a RSET; that action is reserved 1886 for QUIT (see Section 4.1.1.10). 1888 Since EHLO implies some additional processing and response by the 1889 server, RSET will normally be more efficient than reissuing that 1890 command, even though the formal semantics are the same. 1892 Syntax: 1894 rset = "RSET" CRLF 1896 4.1.1.6. VERIFY (VRFY) 1898 This command asks the receiver to confirm that the argument 1899 identifies a user or mailbox. If it is a user name, information is 1900 returned as specified in Section 3.5. 1902 This command has no effect on the reverse-path buffer, the forward- 1903 path buffer, or the mail data buffer. 1905 Syntax: 1907 vrfy = "VRFY" SP String CRLF 1909 4.1.1.7. EXPAND (EXPN) 1911 This command asks the receiver to confirm that the argument 1912 identifies a mailing list, and if so, to return the membership of 1913 that list. If the command is successful, a reply is returned 1914 containing information as described in Section 3.5. This reply will 1915 have multiple lines except in the trivial case of a one-member list. 1917 This command has no effect on the reverse-path buffer, the forward- 1918 path buffer, or the mail data buffer, and it may be issued at any 1919 time. 1921 Syntax: 1923 expn = "EXPN" SP String CRLF 1925 4.1.1.8. HELP (HELP) 1927 This command causes the server to send helpful information to the 1928 client. The command MAY take an argument (e.g., any command name) 1929 and return more specific information as a response. 1931 This command has no effect on the reverse-path buffer, the forward- 1932 path buffer, or the mail data buffer, and it may be issued at any 1933 time. 1935 SMTP servers SHOULD support HELP without arguments and MAY support it 1936 with arguments. 1938 Syntax: 1940 help = "HELP" [ SP String ] CRLF 1942 4.1.1.9. NOOP (NOOP) 1944 This command does not affect any parameters or previously entered 1945 commands. It specifies no action other than that the receiver send a 1946 "250 OK" reply. 1948 This command has no effect on the reverse-path buffer, the forward- 1949 path buffer, or the mail data buffer, and it may be issued at any 1950 time. If a parameter string is specified, servers SHOULD ignore it. 1952 Syntax: 1954 noop = "NOOP" [ SP String ] CRLF 1956 4.1.1.10. QUIT (QUIT) 1958 This command specifies that the receiver MUST send a "221 OK" reply, 1959 and then close the transmission channel. 1961 The receiver MUST NOT intentionally close the transmission channel 1962 until it receives and replies to a QUIT command (even if there was an 1963 error). The sender MUST NOT intentionally close the transmission 1964 channel until it sends a QUIT command, and it SHOULD wait until it 1965 receives the reply (even if there was an error response to a previous 1966 command). If the connection is closed prematurely due to violations 1967 of the above or system or network failure, the server MUST cancel any 1968 pending transaction, but not undo any previously completed 1969 transaction, and generally MUST act as if the command or transaction 1970 in progress had received a temporary error (i.e., a 4yz response). 1972 The QUIT command may be issued at any time. Any current uncompleted 1973 mail transaction will be aborted. 1975 Syntax: 1977 quit = "QUIT" CRLF 1979 4.1.1.11. Mail-Parameter and Rcpt-Parameter Error Responses 1981 If the server SMTP does not recognize or cannot implement one or more 1982 of the parameters associated with a particular MAIL or RCPT command, 1983 it will return code 555. 1985 If, for some reason, the server is temporarily unable to accommodate 1986 one or more of the parameters associated with a MAIL or RCPT command, 1987 and if the definition of the specific parameter does not mandate the 1988 use of another code, it should return code 455. 1990 Errors specific to particular parameters and their values will be 1991 specified in the parameter's defining RFC. 1993 4.1.2. Command Argument Syntax 1995 The syntax of the argument clauses of the above commands (using the 1996 syntax specified in RFC 5234 [11] where applicable) is given below. 1997 Some of the productions given below are used only in conjunction with 1998 source routes as described in Appendix C. Some terminals not defined 1999 in this document, but are defined elsewhere, specifically: 2001 In the "core" syntax in Appendix B of RFC 5234 [11]: ALPHA , CRLF 2002 , DIGIT , HEXDIG , and SP 2004 In the message format syntax in RFC 5322 [12]: atext , CFWS , and 2005 FWS . 2007 Reverse-path = Path / "<>" 2009 Forward-path = Path 2011 Path = "<" [ A-d-l ":" ] Mailbox ">" 2013 A-d-l = At-domain *( "," At-domain ) 2014 ; Note that this form, the so-called "source 2015 ; route", MUST BE accepted, SHOULD NOT be 2016 ; generated, and SHOULD be ignored. 2018 At-domain = "@" Domain 2020 Mail-parameters = esmtp-param *(SP esmtp-param) 2022 Rcpt-parameters = esmtp-param *(SP esmtp-param) 2024 esmtp-param = esmtp-keyword ["=" esmtp-value] 2026 esmtp-keyword = (ALPHA / DIGIT) *(ALPHA / DIGIT / "-") 2028 esmtp-value = 1*(%d33-60 / %d62-126) 2029 ; any CHAR excluding "=", SP, and control 2030 ; characters. If this string is an email address, 2031 ; i.e., a Mailbox, then the "xtext" syntax [34] 2032 ; SHOULD be used. 2034 Keyword = Ldh-str 2036 Argument = Atom 2038 Domain = sub-domain *("." sub-domain) 2040 sub-domain = Let-dig [Ldh-str] 2041 Let-dig = ALPHA / DIGIT 2043 Ldh-str = *( ALPHA / DIGIT / "-" ) Let-dig 2045 address-literal = "[" ( IPv4-address-literal / 2046 IPv6-address-literal / 2047 General-address-literal ) "]" 2048 ; See Section 4.1.3 2050 Mailbox = Local-part "@" ( Domain / address-literal ) 2052 Local-part = Dot-string / Quoted-string 2053 ; MAY be case-sensitive 2055 Dot-string = Atom *("." Atom) 2057 Atom = 1*atext 2059 Quoted-string = DQUOTE 1*QcontentSMTP DQUOTE 2061 QcontentSMTP = qtextSMTP / quoted-pairSMTP 2063 quoted-pairSMTP = %d92 %d32-126 2064 ; i.e., backslash followed by any ASCII 2065 ; graphic (including itself) or SPace 2067 qtextSMTP = %d32-33 / %d35-91 / %d93-126 2068 ; i.e., within a quoted string, any 2069 ; ASCII graphic or space is permitted 2070 ; without backslash-quoting except 2071 ; double-quote and the backslash itself. 2073 String = Atom / Quoted-string 2075 While the above definition for Local-part is relatively permissive, 2076 for maximum interoperability, a host that expects to receive mail 2077 SHOULD avoid defining mailboxes where the Local-part requires (or 2078 uses) the Quoted-string form or where the Local-part is case- 2079 sensitive. For any purposes that require generating or comparing 2080 Local-parts (e.g., to specific mailbox names), all quoted forms MUST 2081 be treated as equivalent, and the sending system SHOULD transmit the 2082 form that uses the minimum quoting possible. 2084 Systems MUST NOT define mailboxes in such a way as to require the use 2085 in SMTP of non-ASCII characters (octets with the high order bit set 2086 to one) or ASCII "control characters" (decimal value 0-31 and 127). 2088 These characters MUST NOT be used in MAIL or RCPT commands or other 2089 commands that require mailbox names. 2091 Note that the backslash, "\", is a quote character, which is used to 2092 indicate that the next character is to be used literally (instead of 2093 its normal interpretation). For example, "Joe\,Smith" indicates a 2094 single nine-character user name string with the comma being the 2095 fourth character of that string. 2097 To promote interoperability and consistent with long-standing 2098 guidance about conservative use of the DNS in naming and applications 2099 (e.g., see Section 2.3.1 of the base DNS document, RFC 1035 [4]), 2100 characters outside the set of alphabetic characters, digits, and 2101 hyphen MUST NOT appear in domain name labels for SMTP clients or 2102 servers. In particular, the underscore character is not permitted. 2103 SMTP servers that receive a command in which invalid character codes 2104 have been employed, and for which there are no other reasons for 2105 rejection, MUST reject that command with a 501 response (this rule, 2106 like others, could be overridden by appropriate SMTP extensions). 2108 4.1.3. Address Literals 2110 Sometimes a host is not known to the domain name system and 2111 communication (and, in particular, communication to report and repair 2112 the error) is blocked. To bypass this barrier, a special literal 2113 form of the address is allowed as an alternative to a domain name. 2114 For IPv4 addresses, this form uses four small decimal integers 2115 separated by dots and enclosed by brackets such as [123.255.37.2], 2116 which indicates an (IPv4) Internet Address in sequence-of-octets 2117 form. For IPv6 and other forms of addressing that might eventually 2118 be standardized, the form consists of a standardized "tag" that 2119 identifies the address syntax, a colon, and the address itself, in a 2120 format specified as part of the relevant standards (i.e., RFC 4291 2121 [10] for IPv6). 2122 [[CREF9: [5321bis] Proposed erratum 4315 (2015-03-27) suggests yet 2123 another modification to the IPv6 address literal syntax, based on 2124 part on RFC 5952. We should consider whether those, or other, 2125 modifications are appropriate and/or whether, given both the issues 2126 of spam/malware and servers supporting multiple domains, it it time 2127 to deprecate mailboxes containing address literals entirely (EHLO 2128 fields may be a different issue). If we are going to allow IPv6 2129 address literals, it may be time to incorporate something by 2130 reference rather than including specific syntax here (RFC 5952 is 14 2131 pages long and does not contain any ABNF).]] 2133 Specifically: 2135 IPv4-address-literal = Snum 3("." Snum) 2136 IPv6-address-literal = "IPv6:" IPv6-addr 2138 General-address-literal = Standardized-tag ":" 1*dcontent 2140 Standardized-tag = Ldh-str 2141 ; Standardized-tag MUST be specified in a 2142 ; Standards-Track RFC and registered with IANA 2144 dcontent = %d33-90 / ; Printable US-ASCII 2145 %d94-126 ; excl. "[", "\", "]" 2147 Snum = 1*3DIGIT 2148 ; representing a decimal integer 2149 ; value in the range 0 through 255 2151 IPv6-addr = 6( h16 ":" ) ls32 2152 / "::" 5( h16 ":" ) ls32 2153 / [ h16 ] "::" 4( h16 ":" ) ls32 2154 / [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32 2155 / [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32 2156 / [ *3( h16 ":" ) h16 ] "::" h16 ":" ls32 2157 / [ *4( h16 ":" ) h16 ] "::" ls32 2158 / [ *5( h16 ":" ) h16 ] "::" h16 2159 / [ *6( h16 ":" ) h16 ] "::" 2160 ; This definition is consistent with the one for 2161 ; URIs [40]. 2163 ls32 = ( h16 ":" h16 ) / IPv4address 2164 ; least-significant 32 bits of address 2166 h16 = 1*4HEXDIG 2167 ; 16 bits of address represented in hexadecimal 2169 4.1.4. Order of Commands 2171 There are restrictions on the order in which these commands may be 2172 used. 2174 A session that will contain mail transactions MUST first be 2175 initialized by the use of the EHLO command. An SMTP server SHOULD 2176 accept commands for non-mail transactions (e.g., VRFY, EXPN, or NOOP) 2177 without this initialization. 2179 An EHLO command MAY be issued by a client later in the session. If 2180 it is issued after the session begins and the EHLO command is 2181 acceptable to the SMTP server, the SMTP server MUST clear all buffers 2182 and reset the state exactly as if a RSET command had been issued 2183 (specifically, it terminates any mail transaction that was in 2184 progress, see Section 3.3). In other words, the sequence of RSET 2185 followed immediately by EHLO is redundant, but not harmful other than 2186 in the performance cost of executing unnecessary commands. However 2187 the response to an additional EHLO command MAY be different from that 2188 from prior ones; the client MUST rely only on the responses from the 2189 most recent EHLO command. 2191 If the EHLO command is not acceptable to the SMTP server, 501, 500, 2192 502, or 550 failure replies MUST be returned as appropriate. The 2193 SMTP server MUST stay in the same state after transmitting these 2194 replies that it was in before the EHLO was received. 2196 The SMTP client MUST, if possible, ensure that the domain parameter 2197 to the EHLO command is a primary host name as specified for this 2198 command in Section 2.3.5. If this is not possible (e.g., when the 2199 client's address is dynamically assigned and the client does not have 2200 an obvious name), an address literal SHOULD be substituted for the 2201 domain name. 2203 An SMTP server MAY verify that the domain name argument in the EHLO 2204 command actually corresponds to the IP address of the client. 2205 [[CREF10: [5321bis] [[Note in draft -- proposed change to "An SMTP 2206 server MAY verify that the domain name argument in the EHLO command 2207 has an address record matching the IP address of the client." ]] 2208 However, if the verification fails, the server MUST NOT refuse to 2209 accept a message on that basis. Information captured in the 2210 verification attempt is for logging and tracing purposes. Note that 2211 this prohibition applies to the matching of the parameter to its IP 2212 address only; see Section 7.9 for a more extensive discussion of 2213 rejecting incoming connections or mail messages. 2215 The NOOP, HELP, EXPN, VRFY, and RSET commands can be used at any time 2216 during a session, or without previously initializing a session. SMTP 2217 servers SHOULD process these normally (that is, not return a 503 2218 code) even if no EHLO command has yet been received; clients SHOULD 2219 open a session with EHLO before sending these commands. 2221 If these rules are followed, the example in RFC 821 that shows "550 2222 access denied to you" in response to an EXPN command is incorrect 2223 unless an EHLO command precedes the EXPN or the denial of access is 2224 based on the client's IP address or other authentication or 2225 authorization-determining mechanisms. 2227 A mail transaction begins with a MAIL command and then consists of 2228 one or more RCPT commands, and a DATA command, in that order. A mail 2229 transaction may be aborted by the RSET, a new EHLO, or the QUIT 2230 command. 2232 SMTP extensions (see Section 2.2) may create additional commands that 2233 initiate, abort, or end the transaction.More generally, any new 2234 command MUST clearly document any effect it has on the transaction 2235 state. 2237 There may be zero or more transactions in a session. MAIL MUST NOT 2238 be sent if a mail transaction is already open, i.e., it should be 2239 sent only if no mail transaction had been started in the session, or 2240 if the previous one successfully concluded with a successful DATA 2241 command, or if the previous one was aborted, e.g., with a RSET or new 2242 EHLO. [[CREF11: [5321bis] See comment about changing this convoluted 2243 discussion to talk about 'mail transaction' above. --Jck (and see 2244 Ticket #11 correspondence with Alexey 2021-07-06)]] 2246 If the transaction beginning command argument is not acceptable, a 2247 501 failure reply MUST be returned and the SMTP server MUST stay in 2248 the same state. If the commands in a transaction are out of order to 2249 the degree that they cannot be processed by the server, a 503 failure 2250 reply MUST be returned and the SMTP server MUST stay in the same 2251 state. 2253 The last command in a session MUST be the QUIT command. The QUIT 2254 command SHOULD be used by the client SMTP to request connection 2255 closure, even when no session opening command was sent and accepted. 2257 4.1.5. Private-Use Commands 2259 As specified in Section 2.2.2, commands starting in "X" may be used 2260 by bilateral agreement between the client (sending) and server 2261 (receiving) SMTP agents. An SMTP server that does not recognize such 2262 a command is expected to reply with "500 Command not recognized". An 2263 extended SMTP server MAY list the feature names associated with these 2264 private commands in the response to the EHLO command. 2266 Commands sent or accepted by SMTP systems that do not start with "X" 2267 MUST conform to the requirements of Section 2.2.2. 2269 4.2. SMTP Replies 2271 Replies to SMTP commands serve to ensure the synchronization of 2272 requests and actions in the process of mail transfer and to guarantee 2273 that the SMTP client always knows the state of the SMTP server. 2274 Every command MUST generate exactly one reply. 2276 The details of the command-reply sequence are described in 2277 Section 4.3. 2279 An SMTP reply consists of a three digit number (transmitted as three 2280 numeric characters) followed by some text unless specified otherwise 2281 in this document. The number is for use by automata to determine 2282 what state to enter next; the text is for the human user. The three 2283 digits contain enough encoded information that the SMTP client need 2284 not examine the text and may either discard it or pass it on to the 2285 user, as appropriate. Exceptions are as noted elsewhere in this 2286 document. In particular, the 220, 221, 251, 421, and 551 reply codes 2287 are associated with message text that must be parsed and interpreted 2288 by machines. In the general case, the text may be receiver dependent 2289 and context dependent, so there are likely to be varying texts for 2290 each reply code. A discussion of the theory of reply codes is given 2291 in Section 4.2.1. Formally, a reply is defined to be the sequence: a 2292 three-digit code, , one line of text, and , or a multiline 2293 reply (as defined in the same section). Since, in violation of this 2294 specification, the text is sometimes not sent, clients that do not 2295 receive it SHOULD be prepared to process the code alone (with or 2296 without a trailing space character). Only the EHLO, EXPN, and HELP 2297 commands are expected to result in multiline replies in normal 2298 circumstances; however, multiline replies are allowed for any 2299 command. 2301 In ABNF, server responses are: 2303 Greeting = ( "220 " (Domain / address-literal) 2304 [ SP textstring ] CRLF ) / 2305 ( "220-" (Domain / address-literal) 2306 [ SP textstring ] CRLF 2307 *( "220-" [ textstring ] CRLF ) 2308 "220" [ SP textstring ] CRLF ) 2310 textstring = 1*(%d09 / %d32-126) ; HT, SP, Printable US-ASCII 2312 Reply-line = *( Reply-code "-" [ textstring ] CRLF ) 2313 Reply-code [ SP textstring ] CRLF 2315 Reply-code = %x32-35 %x30-35 %x30-39 2317 where "Greeting" appears only in the 220 response that announces that 2318 the server is opening its part of the connection. (Other possible 2319 server responses upon connection follow the syntax of Reply-line.) 2321 An SMTP server SHOULD send only the reply codes listed in this 2322 document or additions to the list as discussed below. An SMTP server 2323 SHOULD use the text shown in the examples whenever appropriate. 2325 An SMTP client MUST determine its actions only by the reply code, not 2326 by the text (except for the "change of address" 251 and 551 and, if 2327 necessary, 220, 221, and 421 replies); in the general case, any text, 2328 including no text at all (although senders SHOULD NOT send bare 2329 codes), MUST be acceptable. The space (blank) following the reply 2330 code is considered part of the text. A Sender-SMTP MUST first test 2331 the whole 3 digit reply code it receives, as well as any accompanying 2332 supplemental codes or information (see RFC 3463 [7] and RFC 5248 2333 [46]). If the full reply code is not recognized, and the additional 2334 information is not recognized or missing, the Sender-SMTP MUST use 2335 the first digit (severity indication) of a reply code it receives. 2337 The list of codes that appears below MUST NOT be construed as 2338 permanent. While the addition of new codes should be a rare and 2339 significant activity, with supplemental information in the textual 2340 part of the response (including enhanced status codes [7] and the 2341 successors to that specification) being preferred, new codes may be 2342 added as the result of new Standards or Standards-Track 2343 specifications. Consequently, a sender-SMTP MUST be prepared to 2344 handle codes not specified in this document and MUST do so by 2345 interpreting the first digit only. 2347 In the absence of extensions negotiated with the client, SMTP servers 2348 MUST NOT send reply codes whose first digits are other than 2, 3, 4, 2349 or 5. Clients that receive such out-of-range codes SHOULD normally 2350 treat them as fatal errors and terminate the mail transaction. 2352 4.2.1. Reply Code Severities and Theory 2354 The three digits of the reply each have a special significance. The 2355 first digit denotes whether the response is good, bad, or incomplete. 2356 An unsophisticated SMTP client, or one that receives an unexpected 2357 code, will be able to determine its next action (proceed as planned, 2358 redo, retrench, etc.) by examining this first digit. An SMTP client 2359 that wants to know approximately what kind of error occurred (e.g., 2360 mail system error, command syntax error) may examine the second 2361 digit. The third digit and any supplemental information that may be 2362 present is reserved for the finest gradation of information. 2364 There are four values for the first digit of the reply code: 2366 2yz Positive Completion reply 2367 The requested action has been successfully completed. A new 2368 request may be initiated. 2370 3yz Positive Intermediate reply 2371 The command has been accepted, but the requested action is being 2372 held in abeyance, pending receipt of further information. The 2373 SMTP client should send another command specifying this 2374 information. This reply is used in command sequence groups (i.e., 2375 in DATA). 2377 4yz Transient Negative Completion reply 2378 The command was not accepted, and the requested action did not 2379 occur. However, the error condition is temporary, and the action 2380 may be requested again. The sender should return to the beginning 2381 of the command sequence (if any). It is difficult to assign a 2382 meaning to "transient" when two different sites (receiver- and 2383 sender-SMTP agents) must agree on the interpretation. Each reply 2384 in this category might have a different time value, but the SMTP 2385 client SHOULD try again. A rule of thumb to determine whether a 2386 reply fits into the 4yz or the 5yz category (see below) is that 2387 replies are 4yz if they can be successful if repeated without any 2388 change in command form or in properties of the sender or receiver 2389 (that is, the command is repeated identically and the receiver 2390 does not put up a new implementation). 2392 5yz Permanent Negative Completion reply 2393 The command was not accepted and the requested action did not 2394 occur. The SMTP client SHOULD NOT repeat the exact request (in 2395 the same sequence). Even some "permanent" error conditions can be 2396 corrected, so the human user may want to direct the SMTP client to 2397 reinitiate the command sequence by direct action at some point in 2398 the future (e.g., after the spelling has been changed, or the user 2399 has altered the account status). 2401 It is worth noting that the file transfer protocol (FTP) [15] uses a 2402 very similar code architecture and that the SMTP codes are based on 2403 the FTP model. However, SMTP uses a one-command, one-response model 2404 (while FTP is asynchronous) and FTP's 1yz codes are not part of the 2405 SMTP model. 2407 The second digit encodes responses in specific categories: 2409 x0z Syntax: These replies refer to syntax errors, syntactically 2410 correct commands that do not fit any functional category, and 2411 unimplemented or superfluous commands. 2413 x1z Information: These are replies to requests for information, such 2414 as status or help. 2416 x2z Connections: These are replies referring to the transmission 2417 channel. 2419 x3z Unspecified. 2421 x4z Unspecified. 2423 x5z Mail system: These replies indicate the status of the receiver 2424 mail system vis-a-vis the requested transfer or other mail system 2425 action. 2427 The third digit gives a finer gradation of meaning in each category 2428 specified by the second digit. The list of replies illustrates this. 2429 Each reply text is recommended rather than mandatory, and may even 2430 change according to the command with which it is associated. On the 2431 other hand, the reply codes must strictly follow the specifications 2432 in this section. Receiver implementations should not invent new 2433 codes for slightly different situations from the ones described here, 2434 but rather adapt codes already defined. 2436 For example, a command such as NOOP, whose successful execution does 2437 not offer the SMTP client any new information, will return a 250 2438 reply. The reply is 502 when the command requests an unimplemented 2439 non-site-specific action. A refinement of that is the 504 reply for 2440 a command that is implemented, but that requests an unimplemented 2441 parameter. 2443 The reply text may be longer than a single line; in these cases the 2444 complete text must be marked so the SMTP client knows when it can 2445 stop reading the reply. This requires a special format to indicate a 2446 multiple line reply. 2448 The format for multiline replies requires that every line, except the 2449 last, begin with the reply code, followed immediately by a hyphen, 2450 "-" (also known as minus), followed by text. The last line will 2451 begin with the reply code, followed immediately by , optionally 2452 some text, and . As noted above, servers SHOULD send the 2453 if subsequent text is not sent, but clients MUST be prepared for it 2454 to be omitted. 2456 For example: 2458 250-First line 2459 250-Second line 2460 250-234 Text beginning with numbers 2461 250 The last line 2463 In a multiline reply, the reply code on each of the lines MUST be the 2464 same. It is reasonable for the client to rely on this, so it can 2465 make processing decisions based on the code in any line, assuming 2466 that all others will be the same. In a few cases, there is important 2467 data for the client in the reply "text". The client will be able to 2468 identify these cases from the current context. 2470 4.2.2. Reply Codes by Function Groups 2472 500 Syntax error, command unrecognized (This may include errors such 2473 as command line too long) 2475 501 Syntax error in parameters or arguments 2477 502 Command not implemented (see Section 4.2.4.1) 2479 503 Bad sequence of commands 2481 504 Command parameter not implemented 2483 211 System status, or system help reply 2485 214 Help message (Information on how to use the receiver or the 2486 meaning of a particular non-standard command; this reply is useful 2487 only to the human user) 2489 220 Service ready 2491 221 Service closing transmission channel 2493 421 Service not available, closing transmission channel 2494 (This may be a reply to any command if the service knows it must 2495 shut down) 2497 521 No mail service here. 2499 556 No mail service at this domain. 2501 250 Requested mail action okay, completed 2503 251 User not local; will forward to (See Section 3.4) 2505 252 Cannot VRFY user, but will accept message and attempt delivery 2506 (See Section 3.5.3) 2508 455 Server unable to accommodate parameters 2510 555 MAIL FROM/RCPT TO parameters not recognized or not implemented 2512 450 Requested mail action not taken: mailbox unavailable (e.g., 2513 mailbox busy or temporarily blocked for policy reasons) 2515 550 Requested action not taken: mailbox unavailable (e.g., mailbox 2516 not found, no access, or command rejected for policy reasons) 2518 451 Requested action aborted: error in processing 2520 551 User not local; please try (See Section 3.4) 2522 452 Requested action not taken: insufficient system storage 2523 (preferred code for "too many recipients", see Section 4.5.3.1.10) 2525 552 Requested mail action aborted: exceeded storage allocation. 2527 553 Requested action not taken: mailbox name not allowed (e.g., 2528 mailbox syntax incorrect) 2530 354 Start mail input; end with . 2532 554 Transaction failed (Or, in the case of a connection-opening 2533 response, "No SMTP service here") 2534 [[CREF12: [5321bis] [[Note in Draft: Revise above statement in the 2535 light of new 521 code??]] ]] 2537 4.2.3. Reply Codes in Numeric Order 2539 211 System status, or system help reply 2541 214 Help message (Information on how to use the receiver or the 2542 meaning of a particular non-standard command; this reply is useful 2543 only to the human user) 2545 220 Service ready 2547 221 Service closing transmission channel 2549 250 Requested mail action okay, completed 2551 251 User not local; will forward to (See Section 3.4) 2553 252 Cannot VRFY user, but will accept message and attempt delivery 2554 (See Section 3.5.3) 2556 354 Start mail input; end with . 2557 421 Service not available, closing transmission channel 2558 (This may be a reply to any command if the service knows it must 2559 shut down) 2561 450 Requested mail action not taken: mailbox unavailable (e.g., 2562 mailbox busy or temporarily blocked for policy reasons) 2564 451 Requested action aborted: local error in processing 2566 452 Requested action not taken: insufficient system storage (also 2567 preferred code for "too many recipients", see Section 4.5.3.1.10) 2569 455 Server unable to accommodate parameters 2571 500 Syntax error, command unrecognized (This may include errors such 2572 as command line too long) 2574 501 Syntax error in parameters or arguments 2576 502 Command not implemented (see Section 4.2.4.1) 2578 503 Bad sequence of commands 2580 504 Command parameter not implemented 2582 521 No mail service 2584 550 Requested action not taken: mailbox unavailable (e.g., mailbox 2585 not found, no access, or command rejected for policy reasons) 2587 551 User not local; please try (See Section 3.4) 2589 552 Requested mail action aborted: exceeded storage allocation. 2591 553 Requested action not taken: mailbox name not allowed (e.g., 2592 mailbox syntax incorrect) 2594 554 Transaction failed (Or, in the case of a connection-opening 2595 response, "No SMTP service here") 2597 555 MAIL FROM/RCPT TO parameters not recognized or not implemented 2599 556 No mail service at this domain. 2601 4.2.4. Some specific code situations and relationships 2603 4.2.4.1. Reply Code 502 2605 Questions have been raised as to when reply code 502 (Command not 2606 implemented) SHOULD be returned in preference to other codes. 502 2607 SHOULD be used when the command is actually recognized by the SMTP 2608 server, but not implemented. If the command is not recognized, code 2609 500 SHOULD be returned. Extended SMTP systems MUST NOT list 2610 capabilities in response to EHLO for which they will return 502 (or 2611 500) replies. 2613 4.2.4.2. "No mail accepted" situations and the 521, 554, and 556 codes 2615 Codes 521, 554, and 556 are all used to report different types of "no 2616 mail accepted" situations. They differ as follows. 521 is an 2617 indication from a system answering on the SMTP port that it does not 2618 support SMTP service (a so-called "dummy server" as discussed in RFC 2619 1846 [20] and elsewhere). Obviously, it requires that system exist 2620 and that a connection can be made successfully to it. Because a 2621 system that does not accept any mail cannot meaningfully accept a 2622 RCPT command, any commands (other than QUIT) issued after an SMTP 2623 server has issued a 521 reply are client (sender) errors. 556 is 2624 used by a message submission or intermediate SMTP system (see 2625 Section 1.1) to report that it cannot forward the message further 2626 because it knows (e.g., from a DNS entry [51]) that the recipient 2627 domain does not accept mail. It would normally be used in response 2628 to a RCPT or similar (extension) command when the SMTP system 2629 identifies a domain that it can (or has) determined never accepts 2630 mail. Other codes, including 554 and the temporary 450, are used for 2631 more transient situations and situations in which an SMTP server 2632 cannot or will not deliver to (or accept mail for) a particular 2633 system or mailbox for policy reasons rather than ones directly 2634 related to SMTP processing. 2636 4.2.4.3. Reply Codes after DATA and the Subsequent . 2638 When an SMTP server returns a positive completion status (2yz code) 2639 after the DATA command is completed with ., it accepts 2640 responsibility for: 2642 o delivering the message (if the recipient mailbox exists), or 2644 o if attempts to deliver the message fail due to transient 2645 conditions, retrying delivery some reasonable number of times at 2646 intervals as specified in Section 4.5.4. 2648 o if attempts to deliver the message fail due to permanent 2649 conditions, or if repeated attempts to deliver the message fail 2650 due to transient conditions, returning appropriate notification to 2651 the sender of the original message (using the address in the SMTP 2652 MAIL command). 2654 When an SMTP server returns a temporary error status (4yz) code after 2655 the DATA command is completed with ., it MUST NOT make a 2656 subsequent attempt to deliver that message. The SMTP client retains 2657 responsibility for the delivery of that message and may either return 2658 it to the user or requeue it for a subsequent attempt (see 2659 Section 4.5.4.1). 2661 The user who originated the message SHOULD be able to interpret the 2662 return of a transient failure status (by mail message or otherwise) 2663 as a non-delivery indication, just as a permanent failure would be 2664 interpreted. If the client SMTP successfully handles these 2665 conditions, the user will not receive such a reply. 2667 When an SMTP server returns a permanent error status (5yz) code after 2668 the DATA command is completed with ., it MUST NOT make 2669 any subsequent attempt to deliver the message. As with temporary 2670 error status codes, the SMTP client retains responsibility for the 2671 message, but SHOULD NOT again attempt delivery to the same server 2672 without user review of the message and response and appropriate 2673 intervention. 2675 4.3. Sequencing of Commands and Replies 2677 4.3.1. Sequencing Overview 2679 The communication between the sender and receiver is an alternating 2680 dialogue, controlled by the sender. As such, the sender issues a 2681 command and the receiver responds with a reply. Unless other 2682 arrangements are negotiated through service extensions, the sender 2683 MUST wait for this response before sending further commands. One 2684 important reply is the connection greeting. Normally, a receiver 2685 will send a 220 "Service ready" reply when the connection is 2686 completed. The sender SHOULD wait for this greeting message before 2687 sending any commands. 2689 Note: all the greeting-type replies have the official name (the 2690 fully-qualified primary domain name) of the server host as the first 2691 word following the reply code. Sometimes the host will have no 2692 meaningful name. See Section 4.1.3 for a discussion of alternatives 2693 in these situations. 2695 For example, 2696 220 ISIF.USC.EDU Service ready 2698 or 2700 220 mail.example.com SuperSMTP v 6.1.2 Service ready 2702 or 2704 220 [10.0.0.1] Clueless host service ready 2706 The table below lists alternative success and failure replies for 2707 each command. These SHOULD be strictly adhered to. A receiver MAY 2708 substitute text in the replies, but the meanings and actions implied 2709 by the code numbers and by the specific command reply sequence MUST 2710 be preserved. However, in order to provide robustness as SMTP is 2711 extended and evolves, the discussion in Section 4.2.1 still applies: 2712 all SMTP clients MUST be prepared to accept any code that conforms to 2713 the discussion in that section and MUST be prepared to interpret it 2714 on the basis of its first digit only. 2716 4.3.2. Command-Reply Sequences 2718 Each command is listed with its usual possible replies. The prefixes 2719 used before the possible replies are "I" for intermediate, "S" for 2720 success, and "E" for error. Since some servers may generate other 2721 replies under special circumstances, and to allow for future 2722 extension, SMTP clients SHOULD, when possible, interpret only the 2723 first digit of the reply and MUST be prepared to deal with 2724 unrecognized reply codes by interpreting the first digit only. 2725 Unless extended using the mechanisms described in Section 2.2, SMTP 2726 servers MUST NOT transmit reply codes to an SMTP client that are 2727 other than three digits or that do not start in a digit between 2 and 2728 5 inclusive. 2730 These sequencing rules and, in principle, the codes themselves, can 2731 be extended or modified by SMTP extensions offered by the server and 2732 accepted (requested) by the client. However, if the target is more 2733 precise granularity in the codes, rather than codes for completely 2734 new purposes, the system described in RFC 3463 [7] SHOULD be used in 2735 preference to the invention of new codes. 2737 In addition to the codes listed below, any SMTP command can return 2738 any of the following codes if the corresponding unusual circumstances 2739 are encountered: 2741 500 For the "command line too long" case or if the command name was 2742 not recognized. Note that producing a "command not recognized" 2743 error in response to the required subset of these commands is a 2744 violation of this specification. Similarly, producing a "command 2745 too long" message for a command line shorter than 512 characters 2746 would violate the provisions of Section 4.5.3.1.4. 2748 501 Syntax error in command or arguments. In order to provide for 2749 future extensions, commands that are specified in this document as 2750 not accepting arguments (DATA, RSET, QUIT) SHOULD return a 501 2751 message if arguments are supplied in the absence of EHLO- 2752 advertised extensions. 2754 421 Service shutting down and closing transmission channel 2756 Specific sequences are: 2758 CONNECTION ESTABLISHMENT 2760 S: 220 2761 E: 521, 554 2763 EHLO or HELO 2765 S: 250 2766 E: 504 (a conforming implementation could return this code only 2767 in fairly obscure cases), 550, 502 (permitted only with an old- 2768 style server that does not support EHLO) 2770 MAIL 2772 S: 250 2773 E: 552, 451, 452, 550, 553, 503, 455, 555 2775 RCPT 2777 S: 250, 251 (but see Section 3.4 for discussion of 251 and 551) 2778 E: 550, 551, 552 (obsolete for "too many recipients; see 2779 Section 4.5.3.1.10, 553, 450, 451, 452, 503, 455, 555 2781 DATA 2783 I: 354 -> data -> S: 250 2785 E: 552, 554, 451, 452 2787 E: 450, 550 (rejections for policy reasons) 2789 E: 503, 554 2791 RSET 2793 S: 250 2795 VRFY 2797 S: 250, 251, 252 2798 E: 550, 551, 553, 502, 504 2800 EXPN 2802 S: 250, 252 2803 E: 550, 500, 502, 504 2805 HELP 2807 S: 211, 214 2808 E: 502, 504 2810 NOOP 2812 S: 250 2814 QUIT 2816 S: 221 2818 4.4. Trace Information 2820 When an SMTP server receives a message for delivery or further 2821 processing, it MUST insert trace (often referred to as "time stamp" 2822 or "Received" information) beginning of the message content, as 2823 discussed in Section 4.1.1.4. 2825 This line MUST be structured as follows: 2827 o The FROM clause, which MUST be supplied in an SMTP environment, 2828 SHOULD contain both (1) the name of the source host as presented 2829 in the EHLO command and (2) an address literal containing the IP 2830 address of the source, determined from the TCP connection. 2832 o The ID clause MAY contain an "@" as suggested in RFC 822, but this 2833 is not required. 2835 o If the FOR clause appears, it MUST contain exactly one 2836 entry, even when multiple RCPT commands have been given. Multiple 2837 s raise some security issues and have been deprecated, see 2838 Section 7.2. 2840 An Internet mail program MUST NOT change or delete a Received: line 2841 that was previously added to the message header section. SMTP 2842 servers MUST prepend Received lines to messages; they MUST NOT change 2843 the order of existing lines or insert Received lines in any other 2844 location. 2846 As the Internet grows, comparability of Received header fields is 2847 important for detecting problems, especially slow relays. SMTP 2848 servers that create Received header fields SHOULD use explicit 2849 offsets in the dates (e.g., -0800), rather than time zone names of 2850 any type. Local time (with an offset) SHOULD be used rather than UT 2851 when feasible. This formulation allows slightly more information 2852 about local circumstances to be specified. If UT is needed, the 2853 receiver need merely do some simple arithmetic to convert the values. 2854 Use of UT loses information about the time zone-location of the 2855 server. If it is desired to supply a time zone name, it SHOULD be 2856 included in a comment. 2858 When the delivery SMTP server makes the "final delivery" of a 2859 message, it inserts a return-path line at the beginning of the mail 2860 data. This use of return-path is required; mail systems MUST support 2861 it. The return-path line preserves the information in the from the MAIL command. Here, final delivery means the message 2863 has left the SMTP environment. Normally, this would mean it had been 2864 delivered to the destination user or an associated mail drop, but in 2865 some cases it may be further processed and transmitted by another 2866 mail system. 2868 It is possible for the mailbox in the return path to be different 2869 from the actual sender's mailbox, for example, if error responses are 2870 to be delivered to a special error handling mailbox rather than to 2871 the message sender. When mailing lists are involved, this 2872 arrangement is common and useful as a means of directing errors to 2873 the list maintainer rather than the message originator. 2875 The text above implies that the final mail data will begin with a 2876 return path line, followed by one or more time stamp lines. These 2877 lines will be followed by the rest of the mail data: first the 2878 balance of the mail header section and then the body (RFC 5322 [12]). 2880 It is sometimes difficult for an SMTP server to determine whether or 2881 not it is making final delivery since forwarding or other operations 2882 may occur after the message is accepted for delivery. Consequently, 2883 any further (forwarding, gateway, or relay) systems MAY remove the 2884 return path and rebuild the MAIL command as needed to ensure that 2885 exactly one such line appears in a delivered message. 2887 A message-originating SMTP system SHOULD NOT send a message that 2888 already contains a Return-path header field. SMTP servers performing 2889 a relay function MUST NOT inspect the message data, and especially 2890 not to the extent needed to determine if Return-path header fields 2891 are present. SMTP servers making final delivery MAY remove Return- 2892 path header fields before adding their own. 2894 The primary purpose of the Return-path is to designate the address to 2895 which messages indicating non-delivery or other mail system failures 2896 are to be sent. For this to be unambiguous, exactly one return path 2897 SHOULD be present when the message is delivered. Systems using RFC 2898 822 syntax with non-SMTP transports SHOULD designate an unambiguous 2899 address, associated with the transport envelope, to which error 2900 reports (e.g., non-delivery messages) should be sent. 2902 Historical note: Text in RFC 822 that appears to contradict the use 2903 of the Return-path header field (or the envelope reverse-path address 2904 from the MAIL command) as the destination for error messages is not 2905 applicable on the Internet. The reverse-path address (as copied into 2906 the Return-path) MUST be used as the target of any mail containing 2907 delivery error messages. 2909 In particular: 2911 o a gateway from SMTP -> elsewhere SHOULD insert a return-path 2912 header field, unless it is known that the "elsewhere" transport 2913 also uses Internet domain addresses and maintains the envelope 2914 sender address separately. 2916 o a gateway from elsewhere -> SMTP SHOULD delete any return-path 2917 header field present in the message, and either copy that 2918 information to the SMTP envelope or combine it with information 2919 present in the envelope of the other transport system to construct 2920 the reverse-path argument to the MAIL command in the SMTP 2921 envelope. 2923 The server must give special treatment to cases in which the 2924 processing following the end of mail data indication is only 2925 partially successful. This could happen if, after accepting several 2926 recipients and the mail data, the SMTP server finds that the mail 2927 data could be successfully delivered to some, but not all, of the 2928 recipients. In such cases, the response to the DATA command MUST be 2929 an OK reply. However, the SMTP server MUST compose and send an 2930 "undeliverable mail" notification message to the originator of the 2931 message. 2933 A single notification listing all of the failed recipients or 2934 separate notification messages MUST be sent for each failed 2935 recipient. For economy of processing by the sender, the former 2936 SHOULD be used when possible. Note that the key difference between 2937 handling aliases (Section 3.9.1) and forwarding (this subsection) is 2938 the change to the backward-pointing address in this case. All 2939 notification messages about undeliverable mail MUST be sent using the 2940 MAIL command and MUST use a null return path as discussed in 2941 Section 3.6. 2943 The time stamp line and the return path line are formally defined as 2944 follows (the definitions for "FWS" and "CFWS" appear in RFC 5322 2945 [12]): 2947 Return-path-line = "Return-Path:" FWS Reverse-path 2949 Time-stamp-line = "Received:" FWS Stamp 2951 Stamp = From-domain By-domain Opt-info [CFWS] ";" 2952 FWS date-time 2953 ; where "date-time" is as defined in RFC 5322 [12] 2954 ; but the "obs-" forms, especially two-digit 2955 ; years, are prohibited in SMTP and MUST NOT be used. 2957 From-domain = "FROM" FWS Extended-Domain 2959 By-domain = CFWS "BY" FWS Extended-Domain 2961 Extended-Domain = Domain / 2962 ( Domain FWS "(" TCP-info ")" ) / 2963 ( address-literal FWS "(" TCP-info ")" ) 2965 TCP-info = address-literal / ( Domain FWS address-literal ) 2966 ; Information derived by server from TCP connection 2967 ; not client EHLO. 2969 Opt-info = [Via] [With] [ID] [For] 2970 [Additional-Registered-Clauses] 2972 Via = CFWS "VIA" FWS Link 2974 With = CFWS "WITH" FWS Protocol 2976 ID = CFWS "ID" FWS ( Atom / msg-id ) 2977 ; msg-id is defined in RFC 5322 [12] 2979 For = CFWS "FOR" FWS ( Path / Mailbox ) 2981 Additional-Registered-Clauses = 1* (CFWS Atom FWS String) 2983 [[CREF13: [5321bis] 5321 errata #1683, 20090215, ]] 2984 ; Additional standard clauses may be added in this 2985 ; location by future standards and registration with 2986 ; IANA. SMTP servers SHOULD NOT use unregistered 2987 ; names. See Section 8. 2989 Link = "TCP" / Addtl-Link 2991 Addtl-Link = Atom 2992 ; Additional standard names for links are 2993 ; registered with the Internet Assigned Numbers 2994 ; Authority (IANA). "Via" is primarily of value 2995 ; with non-Internet transports. SMTP servers 2996 ; SHOULD NOT use unregistered names. 2998 Protocol = "ESMTP" / "SMTP" / Attdl-Protocol 3000 Addtl-Protocol = Atom 3001 ; Additional standard names for protocols are 3002 ; registered with the Internet Assigned Numbers 3003 ; Authority (IANA) in the "mail parameters" 3004 ; registry [8]. SMTP servers SHOULD NOT 3005 ; use unregistered names. 3007 4.5. Additional Implementation Issues 3009 4.5.1. Minimum Implementation 3011 In order to make SMTP workable, the following minimum implementation 3012 MUST be provided by all receivers. The following commands MUST be 3013 supported to conform to this specification: 3015 EHLO 3016 HELO 3017 MAIL 3018 RCPT 3019 DATA 3020 RSET 3021 NOOP 3022 QUIT 3023 VRFY 3025 Any system that includes an SMTP server supporting mail relaying or 3026 delivery MUST support the reserved mailbox "postmaster" as a case- 3027 insensitive local name. This postmaster address is not strictly 3028 necessary if the server always returns 554 on connection opening (as 3029 described in Section 3.1). The requirement to accept mail for 3030 postmaster implies that RCPT commands that specify a mailbox for 3031 postmaster at any of the domains for which the SMTP server provides 3032 mail service, as well as the special case of "RCPT TO:" 3033 (with no domain specification), MUST be supported. 3035 SMTP systems are expected to make every reasonable effort to accept 3036 mail directed to Postmaster from any other system on the Internet. 3037 In extreme cases -- such as to contain a denial of service attack or 3038 other breach of security -- an SMTP server may block mail directed to 3039 Postmaster. However, such arrangements SHOULD be narrowly tailored 3040 so as to avoid blocking messages that are not part of such attacks. 3042 4.5.2. Transparency 3044 Without some provision for data transparency, the character sequence 3045 "." ends the mail text and cannot be sent by the user. 3046 In general, users are not aware of such "forbidden" sequences. To 3047 allow all user composed text to be transmitted transparently, the 3048 following procedures are used: 3050 o Before sending a line of mail text, the SMTP client checks the 3051 first character of the line. If it is a period, one additional 3052 period is inserted at the beginning of the line. 3054 o When a line of mail text is received by the SMTP server, it checks 3055 the line. If the line is composed of a single period, it is 3056 treated as the end of mail indicator. If the first character is a 3057 period and there are other characters on the line, the first 3058 character is deleted. 3060 The mail data may contain any of the 128 ASCII characters. All 3061 characters are to be delivered to the recipient's mailbox, including 3062 spaces, vertical and horizontal tabs, and other control characters. 3063 If the transmission channel provides an 8-bit byte (octet) data 3064 stream, the 7-bit ASCII codes are transmitted, right justified, in 3065 the octets, with the high-order bits cleared to zero. See 3066 Section 3.6 for special treatment of these conditions in SMTP systems 3067 serving a relay function. 3069 In some systems, it may be necessary to transform the data as it is 3070 received and stored. This may be necessary for hosts that use a 3071 different character set than ASCII as their local character set, that 3072 store data in records rather than strings, or which use special 3073 character sequences as delimiters inside mailboxes. If such 3074 transformations are necessary, they MUST be reversible, especially if 3075 they are applied to mail being relayed. 3077 4.5.3. Sizes and Timeouts 3079 4.5.3.1. Size Limits and Minimums 3081 There are several objects that have required minimum/maximum sizes. 3082 Every implementation MUST be able to receive objects of at least 3083 these sizes. Objects larger than these sizes SHOULD be avoided when 3084 possible. However, some Internet mail constructs such as encoded 3085 X.400 addresses (RFC 2156 [27]) will often require larger objects. 3086 Clients MAY attempt to transmit these, but MUST be prepared for a 3087 server to reject them if they cannot be handled by it. To the 3088 maximum extent possible, implementation techniques that impose no 3089 limits on the length of these objects should be used. 3091 Extensions to SMTP may involve the use of characters that occupy more 3092 than a single octet each. This section therefore specifies lengths 3093 in octets where absolute lengths, rather than character counts, are 3094 intended. 3096 [[CREF14: [5321bis] [[Note in Draft: Klensin 20191126: Given the 3097 controversy on the SMTP mailing list between 20191123 and now about 3098 maximum lengths, is the above adequate or is further tuning of the 3099 limit text below needed? ]]]] 3101 4.5.3.1.1. Local-part 3103 The maximum total length of a user name or other local-part is 64 3104 octets. 3106 4.5.3.1.2. Domain 3108 The maximum total length of a domain name or number is 255 octets. 3110 4.5.3.1.3. Path 3112 The maximum total length of a reverse-path or forward-path is 256 3113 octets (including the punctuation and element separators). 3115 4.5.3.1.4. Command Line 3117 The maximum total length of a command line including the command word 3118 and the is 512 octets. SMTP extensions may be used to 3119 increase this limit. 3121 4.5.3.1.5. Reply Line 3123 The maximum total length of a reply line including the reply code and 3124 the is 512 octets. More information may be conveyed through 3125 multiple-line replies. 3127 4.5.3.1.6. Text Line 3129 The maximum total length of a text line including the is 1000 3130 octets (not counting the leading dot duplicated for transparency). 3131 This number may be increased by the use of SMTP Service Extensions. 3133 4.5.3.1.7. Message Content 3135 The maximum total length of a message content (including any message 3136 header section as well as the message body) MUST BE at least 64K 3137 octets. Since the introduction of Internet Standards for multimedia 3138 mail (RFC 2045 [25]), message lengths on the Internet have grown 3139 dramatically, and message size restrictions should be avoided if at 3140 all possible. SMTP server systems that must impose restrictions 3141 SHOULD implement the "SIZE" service extension of RFC 1870 [6], and 3142 SMTP client systems that will send large messages SHOULD utilize it 3143 when possible. 3145 4.5.3.1.8. Recipient Buffer 3147 The minimum total number of recipients that MUST be buffered is 100 3148 recipients. Rejection of messages (for excessive recipients) with 3149 fewer than 100 RCPT commands is a violation of this specification. 3150 The general principle that relaying SMTP server MUST NOT, and 3151 delivery SMTP servers SHOULD NOT, perform validation tests on message 3152 header fields suggests that messages SHOULD NOT be rejected based on 3153 the total number of recipients shown in header fields. A server that 3154 imposes a limit on the number of recipients MUST behave in an orderly 3155 fashion, such as rejecting additional addresses over its limit rather 3156 than silently discarding addresses previously accepted. A client 3157 that needs to deliver a message containing over 100 RCPT commands 3158 SHOULD be prepared to transmit in 100-recipient "chunks" if the 3159 server declines to accept more than 100 recipients in a single 3160 message. 3162 4.5.3.1.9. Treatment When Limits Exceeded 3164 Errors due to exceeding these limits may be reported by using the 3165 reply codes. Some examples of reply codes are: 3167 500 Line too long. 3169 or 3171 501 Path too long 3173 or 3175 452 Too many recipients (see below) 3177 or 3179 552 Too much mail data (historically also used for too many 3180 recipients (see below). 3182 4.5.3.1.10. Too Many Recipients Code 3184 RFC 821 [3] incorrectly listed the error where an SMTP server 3185 exhausts its implementation limit on the number of RCPT commands 3186 ("too many recipients") as having reply code 552. The correct reply 3187 code for this condition is 452. At the time RFC 5321 was written, 3188 the use of response code 552 by servers was sufficiently common that 3189 client implementation were advised to simply treat it as if 452 had 3190 been sent. That advice is no longer necessary or useful. 3192 When a conforming SMTP server encounters this condition, it has at 3193 least 100 successful RCPT commands in its recipient buffer. If the 3194 server is able to accept the message, then at least these 100 3195 addresses will be removed from the SMTP client's queue. When the 3196 client attempts retransmission of those addresses that received 452 3197 responses, at least 100 of these will be able to fit in the SMTP 3198 server's recipient buffer. Each retransmission attempt that is able 3199 to deliver anything will be able to dispose of at least 100 of these 3200 recipients. 3202 If an SMTP server has an implementation limit on the number of RCPT 3203 commands and this limit is exhausted, it MUST use a response code of 3204 452. If the server has a configured site-policy limitation on the 3205 number of RCPT commands, it MAY instead use a 5yz response code. In 3206 particular, if the intent is to prohibit messages with more than a 3207 site-specified number of recipients, rather than merely limit the 3208 number of recipients in a given mail transaction, it would be 3209 reasonable to return a 503 response to any DATA command received 3210 subsequent to the 452 code or to simply return the 503 after DATA 3211 without returning any previous negative response. 3213 4.5.3.2. Timeouts 3215 An SMTP client MUST provide a timeout mechanism. It MUST use per- 3216 command timeouts rather than somehow trying to time the entire mail 3217 transaction. Timeouts SHOULD be easily reconfigurable, preferably 3218 without recompiling the SMTP code. To implement this, a timer is set 3219 for each SMTP command and for each buffer of the data transfer. The 3220 latter means that the overall timeout is inherently proportional to 3221 the size of the message. 3223 Based on extensive experience with busy mail-relay hosts, the minimum 3224 per-command timeout values SHOULD be as follows: 3226 4.5.3.2.1. Initial 220 Message: 5 Minutes 3228 An SMTP client process needs to distinguish between a failed TCP 3229 connection and a delay in receiving the initial 220 greeting message. 3230 Many SMTP servers accept a TCP connection but delay delivery of the 3231 220 message until their system load permits more mail to be 3232 processed. 3234 4.5.3.2.2. MAIL Command: 5 Minutes 3236 4.5.3.2.3. RCPT Command: 5 Minutes 3238 A longer timeout is required if processing of mailing lists and 3239 aliases is not deferred until after the message was accepted. 3241 4.5.3.2.4. DATA Initiation: 2 Minutes 3243 This is while awaiting the "354 Start Input" reply to a DATA command. 3245 4.5.3.2.5. Data Block: 3 Minutes 3247 This is while awaiting the completion of each TCP SEND call 3248 transmitting a chunk of data. 3250 4.5.3.2.6. DATA Termination: 10 Minutes. 3252 This is while awaiting the "250 OK" reply. When the receiver gets 3253 the final period terminating the message data, it typically performs 3254 processing to deliver the message to a user mailbox. A spurious 3255 timeout at this point would be very wasteful and would typically 3256 result in delivery of multiple copies of the message, since it has 3257 been successfully sent and the server has accepted responsibility for 3258 delivery. See Section 6.1 for additional discussion. 3260 4.5.3.2.7. Server Timeout: 5 Minutes. 3262 An SMTP server SHOULD have a timeout of at least 5 minutes while it 3263 is awaiting the next command from the sender. 3265 4.5.4. Retry Strategies 3267 The common structure of a host SMTP implementation includes user 3268 mailboxes, one or more areas for queuing messages in transit, and one 3269 or more daemon processes for sending and receiving mail. The exact 3270 structure will vary depending on the needs of the users on the host 3271 and the number and size of mailing lists supported by the host. We 3272 describe several optimizations that have proved helpful, particularly 3273 for mailers supporting high traffic levels. 3275 Any queuing strategy MUST include timeouts on all activities on a 3276 per-command basis. A queuing strategy MUST NOT send error messages 3277 in response to error messages under any circumstances. 3279 4.5.4.1. Sending Strategy 3281 The general model for an SMTP client is one or more processes that 3282 periodically attempt to transmit outgoing mail. In a typical system, 3283 the program that composes a message has some method for requesting 3284 immediate attention for a new piece of outgoing mail, while mail that 3285 cannot be transmitted immediately MUST be queued and periodically 3286 retried by the sender. A mail queue entry will include not only the 3287 message itself but also the envelope information. 3289 The sender MUST delay retrying a particular destination after one 3290 attempt has failed. In general, the retry interval SHOULD be at 3291 least 30 minutes; however, more sophisticated and variable strategies 3292 will be beneficial when the SMTP client can determine the reason for 3293 non-delivery. 3295 Retries continue until the message is transmitted or the sender gives 3296 up; the give-up time generally needs to be at least 4-5 days. It MAY 3297 be appropriate to set a shorter maximum number of retries for non- 3298 delivery notifications and equivalent error messages than for 3299 standard messages. The parameters to the retry algorithm MUST be 3300 configurable. 3302 A client SHOULD keep a list of hosts it cannot reach and 3303 corresponding connection timeouts, rather than just retrying queued 3304 mail items. 3306 Experience suggests that failures are typically transient (the target 3307 system or its connection has crashed), favoring a policy of two 3308 connection attempts in the first hour the message is in the queue, 3309 and then backing off to one every two or three hours. 3311 The SMTP client can shorten the queuing delay in cooperation with the 3312 SMTP server. For example, if mail is received from a particular 3313 address, it is likely that mail queued for that host can now be sent. 3314 Application of this principle may, in many cases, eliminate the 3315 requirement for an explicit "send queues now" function such as ETRN, 3316 RFC 1985 [24]. 3318 The strategy may be further modified as a result of multiple 3319 addresses per host (see below) to optimize delivery time versus 3320 resource usage. 3322 An SMTP client may have a large queue of messages for each 3323 unavailable destination host. If all of these messages were retried 3324 in every retry cycle, there would be excessive Internet overhead and 3325 the sending system would be blocked for a long period. Note that an 3326 SMTP client can generally determine that a delivery attempt has 3327 failed only after a timeout of several minutes, and even a one-minute 3328 timeout per connection will result in a very large delay if retries 3329 are repeated for dozens, or even hundreds, of queued messages to the 3330 same host. 3332 At the same time, SMTP clients SHOULD use great care in caching 3333 negative responses from servers. In an extreme case, if EHLO is 3334 issued multiple times during the same SMTP connection, different 3335 answers may be returned by the server. More significantly, 5yz 3336 responses to the MAIL command MUST NOT be cached. 3338 When a mail message is to be delivered to multiple recipients, and 3339 the SMTP server to which a copy of the message is to be sent is the 3340 same for multiple recipients, then only one copy of the message 3341 SHOULD be transmitted. That is, the SMTP client SHOULD use the 3342 command sequence: MAIL, RCPT, RCPT, ..., RCPT, DATA instead of the 3343 sequence: MAIL, RCPT, DATA, ..., MAIL, RCPT, DATA. However, if there 3344 are very many addresses, a limit on the number of RCPT commands per 3345 MAIL command MAY be imposed. This efficiency feature SHOULD be 3346 implemented. 3348 Similarly, to achieve timely delivery, the SMTP client MAY support 3349 multiple concurrent outgoing mail transactions. However, some limit 3350 may be appropriate to protect the host from devoting all its 3351 resources to mail. 3353 4.5.4.2. Receiving Strategy 3355 The SMTP server SHOULD attempt to keep a pending listen on the SMTP 3356 port (specified by IANA as port 25) at all times. This requires the 3357 support of multiple incoming TCP connections for SMTP. Some limit 3358 MAY be imposed, but servers that cannot handle more than one SMTP 3359 transaction at a time are not in conformance with the intent of this 3360 specification. 3362 As discussed above, when the SMTP server receives mail from a 3363 particular host address, it could activate its own SMTP queuing 3364 mechanisms to retry any mail pending for that host address. 3366 4.5.5. Messages with a Null Reverse-Path 3368 There are several types of notification messages that are required by 3369 existing and proposed Standards to be sent with a null reverse-path, 3370 namely non-delivery notifications as discussed in Section 3.6.2 and 3371 Section 3.6.3, other kinds of Delivery Status Notifications (DSNs, 3372 RFC 3461 [34]), and Message Disposition Notifications (MDNs, RFC 8098 3373 [37]). All of these kinds of messages are notifications about a 3374 previous message, and they are sent to the reverse-path of the 3375 previous mail message. (If the delivery of such a notification 3376 message fails, that usually indicates a problem with the mail system 3377 of the host to which the notification message is addressed. For this 3378 reason, at some hosts the MTA is set up to forward such failed 3379 notification messages to someone who is able to fix problems with the 3380 mail system, e.g., via the postmaster alias.) 3382 All other types of messages (i.e., any message which is not required 3383 by a Standards-Track RFC to have a null reverse-path) SHOULD be sent 3384 with a valid, non-null reverse-path. 3386 Implementers of automated email processors should be careful to make 3387 sure that the various kinds of messages with a null reverse-path are 3388 handled correctly. In particular, such systems SHOULD NOT reply to 3389 messages with a null reverse-path, and they SHOULD NOT add a non-null 3390 reverse-path, or change a null reverse-path to a non-null one, to 3391 such messages when forwarding. 3393 5. Address Resolution and Mail Handling 3395 5.1. Locating the Target Host 3397 Once an SMTP client lexically identifies a domain to which mail will 3398 be delivered for processing (as described in Sections 2.3.5 and 3.6), 3399 a DNS lookup MUST be performed to resolve the domain name (RFC 1035 3400 [4]). The names are expected to be fully-qualified domain names 3401 (FQDNs): mechanisms for inferring FQDNs from partial names or local 3402 aliases are outside of this specification. Due to a history of 3403 problems, SMTP servers used for initial submission of messages SHOULD 3404 NOT make such inferences (Message Submission Servers [42] have 3405 somewhat more flexibility) and intermediate (relay) SMTP servers MUST 3406 NOT make them. 3408 The lookup first attempts to locate an MX record associated with the 3409 name. If a CNAME record is found, the resulting name is processed as 3410 if it were the initial name. If a non-existent domain error is 3411 returned, this situation MUST be reported as an error. If a 3412 temporary error is returned, the message MUST be queued and retried 3413 later (see Section 4.5.4.1). If an empty list of MXs is returned, 3414 the address is treated as if it was associated with an implicit MX 3415 RR, with a preference of 0, pointing to that host. If MX records are 3416 present, but none of them are usable, or the implicit MX is unusable, 3417 this situation MUST be reported as an error. 3419 If one or more MX RRs are found for a given name, SMTP systems MUST 3420 NOT utilize any address RRs associated with that name unless they are 3421 located using the MX RRs; the "implicit MX" rule above applies only 3422 if there are no MX records present. If MX records are present, but 3423 none of them are usable, this situation MUST be reported as an error. 3425 When a domain name associated with an MX RR is looked up and the 3426 associated data field obtained, the data field of that response MUST 3427 contain a domain name that conforms to the specifications of 3428 Section 2.3.5. 3429 [[5321bis Editor's Note: Depending on how the "null MX" discussion 3430 unfolds, some additional text may be in order here (20140718)]] 3431 That domain name, when queried, MUST return at least one address 3432 record (e.g., A or AAAA RR) that gives the IP address of the SMTP 3433 server to which the message should be directed. Any other response, 3434 specifically including a value that will return a CNAME record when 3435 queried, lies outside the scope of this Standard. The prohibition on 3436 labels in the data that resolve to CNAMEs is discussed in more detail 3437 in RFC 2181, Section 10.3 [28]. 3439 When the lookup succeeds, the mapping can result in a list of 3440 alternative delivery addresses rather than a single address, because 3441 of multiple MX records, multihoming, or both. To provide reliable 3442 mail transmission, the SMTP client MUST be able to try (and retry) 3443 each of the relevant addresses in this list in order, until a 3444 delivery attempt succeeds. However, there MAY also be a configurable 3445 limit on the number of alternate addresses that can be tried. In any 3446 case, the SMTP client SHOULD try at least two addresses. 3448 Two types of information are used to rank the host addresses: 3449 multiple MX records, and multihomed hosts. 3451 MX records contain a preference indication that MUST be used in 3452 sorting if more than one such record appears (see below). Lower 3453 numbers are more preferred than higher ones. If there are multiple 3454 destinations with the same preference and there is no clear reason to 3455 favor one (e.g., by recognition of an easily reached address), then 3456 the sender-SMTP MUST randomize them to spread the load across 3457 multiple mail exchangers for a specific organization. 3459 The destination host (perhaps taken from the preferred MX record) may 3460 be multihomed, in which case the domain name resolver will return a 3461 list of alternative IP addresses. It is the responsibility of the 3462 domain name resolver interface to have ordered this list by 3463 decreasing preference if necessary, and the SMTP sender MUST try them 3464 in the order presented. 3466 Although the capability to try multiple alternative addresses is 3467 required, specific installations may want to limit or disable the use 3468 of alternative addresses. The question of whether a sender should 3469 attempt retries using the different addresses of a multihomed host 3470 has been controversial. The main argument for using the multiple 3471 addresses is that it maximizes the probability of timely delivery, 3472 and indeed sometimes the probability of any delivery; the counter- 3473 argument is that it may result in unnecessary resource use. Note 3474 that resource use is also strongly determined by the sending strategy 3475 discussed in Section 4.5.4.1. 3477 If an SMTP server receives a message with a destination for which it 3478 is a designated Mail eXchanger, it MAY relay the message (potentially 3479 after having rewritten the MAIL FROM and/or RCPT TO addresses), make 3480 final delivery of the message, or hand it off using some mechanism 3481 outside the SMTP-provided transport environment. Of course, neither 3482 of the latter require that the list of MX records be examined 3483 further. 3485 If it determines that it should relay the message without rewriting 3486 the address, it MUST sort the MX records to determine candidates for 3487 delivery. The records are first ordered by preference, with the 3488 lowest-numbered records being most preferred. The relay host MUST 3489 then inspect the list for any of the names or addresses by which it 3490 might be known in mail transactions. If a matching record is found, 3491 all records at that preference level and higher-numbered ones MUST be 3492 discarded from consideration. If there are no records left at that 3493 point, it is an error condition, and the message MUST be returned as 3494 undeliverable. If records do remain, they SHOULD be tried, best 3495 preference first, as described above. 3497 5.2. IPv6 and MX Records 3499 In the contemporary Internet, SMTP clients and servers may be hosted 3500 on IPv4 systems, IPv6 systems, or dual-stack systems that are 3501 compatible with either version of the Internet Protocol. The host 3502 domains to which MX records point may, consequently, contain "A RR"s 3503 (IPv4), "AAAA RR"s (IPv6), or any combination of them. While RFC 3504 3974 [39] discusses some operational experience in mixed 3505 environments, it was not comprehensive enough to justify 3506 standardization, and some of its recommendations appear to be 3507 inconsistent with this specification. The appropriate actions to be 3508 taken either will depend on local circumstances, such as performance 3509 of the relevant networks and any conversions that might be necessary, 3510 or will be obvious (e.g., an IPv6-only client need not attempt to 3511 look up A RRs or attempt to reach IPv4-only servers). Designers of 3512 SMTP implementations that might run in IPv6 or dual-stack 3513 environments should study the procedures above, especially the 3514 comments about multihomed hosts, and, preferably, provide mechanisms 3515 to facilitate operational tuning and mail interoperability between 3516 IPv4 and IPv6 systems while considering local circumstances. 3518 6. Problem Detection and Handling 3520 6.1. Reliable Delivery and Replies by Email 3522 When the receiver-SMTP accepts a piece of mail (by sending a "250 OK" 3523 message in response to DATA), it is accepting responsibility for 3524 delivering or relaying the message. It must take this responsibility 3525 seriously. It MUST NOT lose the message for frivolous reasons, such 3526 as because the host later crashes or because of a predictable 3527 resource shortage. Some reasons that are not considered frivolous 3528 are discussed in the next subsection and in Section 7.8. 3530 If there is a delivery failure after acceptance of a message, the 3531 receiver-SMTP MUST formulate and mail a notification message. This 3532 notification MUST be sent using a null ("<>") reverse-path in the 3533 envelope. The recipient of this notification MUST be the address 3534 from the envelope return path (or the Return-Path: line). However, 3535 if this address is null ("<>"), the receiver-SMTP MUST NOT send a 3536 notification. Obviously, nothing in this section can or should 3537 prohibit local decisions (i.e., as part of the same system 3538 environment as the receiver-SMTP) to log or otherwise transmit 3539 information about null address events locally if that is desired. If 3540 the address is an explicit source route, it MUST be stripped down to 3541 its final hop. 3543 For example, suppose that an error notification must be sent for a 3544 message that arrived with: 3546 MAIL FROM:<@a,@b:user@d> 3548 The notification message MUST be sent using: 3550 RCPT TO: 3552 Some delivery failures after the message is accepted by SMTP will be 3553 unavoidable. For example, it may be impossible for the receiving 3554 SMTP server to validate all the delivery addresses in RCPT command(s) 3555 due to a "soft" domain system error, because the target is a mailing 3556 list (see earlier discussion of RCPT), or because the server is 3557 acting as a relay and has no immediate access to the delivering 3558 system. 3560 To avoid receiving duplicate messages as the result of timeouts, a 3561 receiver-SMTP MUST seek to minimize the time required to respond to 3562 the final . end of data indicator. See RFC 1047 [17] for 3563 a discussion of this problem. 3565 6.2. Unwanted, Unsolicited, and "Attack" Messages 3567 Utility and predictability of the Internet mail system requires that 3568 messages that can be delivered should be delivered, regardless of any 3569 syntax or other faults associated with those messages and regardless 3570 of their content. If they cannot be delivered, and cannot be 3571 rejected by the SMTP server during the SMTP transaction, they should 3572 be "bounced" (returned with non-delivery notification messages) as 3573 described above. In today's world, in which many SMTP server 3574 operators have discovered that the quantity of undesirable bulk email 3575 vastly exceeds the quantity of desired mail and in which accepting a 3576 message may trigger additional undesirable traffic by providing 3577 verification of the address, those principles may not be practical. 3579 As discussed in Section 7.8 and Section 7.9 below, dropping mail 3580 without notification of the sender is permitted in practice. 3581 However, it is extremely dangerous and violates a long tradition and 3582 community expectations that mail is either delivered or returned. If 3583 silent message-dropping is misused, it could easily undermine 3584 confidence in the reliability of the Internet's mail systems. So 3585 silent dropping of messages should be considered only in those cases 3586 where there is very high confidence that the messages are seriously 3587 fraudulent or otherwise inappropriate. 3589 To stretch the principle of delivery if possible even further, it may 3590 be a rational policy to not deliver mail that has an invalid return 3591 address, although the history of the network is that users are 3592 typically better served by delivering any message that can be 3593 delivered. Reliably determining that a return address is invalid can 3594 be a difficult and time-consuming process, especially if the putative 3595 sending system is not directly accessible or does not fully and 3596 accurately support VRFY and, even if a "drop messages with invalid 3597 return addresses" policy is adopted, it SHOULD be applied only when 3598 there is near-certainty that the return addresses are, in fact, 3599 invalid. 3601 Conversely, if a message is rejected because it is found to contain 3602 hostile content (a decision that is outside the scope of an SMTP 3603 server as defined in this document), rejection ("bounce") messages 3604 SHOULD NOT be sent unless the receiving site is confident that those 3605 messages will be usefully delivered. The preference and default in 3606 these cases is to avoid sending non-delivery messages when the 3607 incoming message is determined to contain hostile content. 3609 6.3. Loop Detection 3611 Simple counting of the number of "Received:" header fields in a 3612 message has proven to be an effective, although rarely optimal, 3613 method of detecting loops in mail systems. SMTP servers using this 3614 technique SHOULD use a large rejection threshold, normally at least 3615 100 Received entries. Whatever mechanisms are used, servers MUST 3616 contain provisions for detecting and stopping trivial loops. 3618 6.4. Compensating for Irregularities 3620 Unfortunately, variations, creative interpretations, and outright 3621 violations of Internet mail protocols do occur; some would suggest 3622 that they occur quite frequently. The debate as to whether a well- 3623 behaved SMTP receiver or relay should reject a malformed message, 3624 attempt to pass it on unchanged, or attempt to repair it to increase 3625 the odds of successful delivery (or subsequent reply) began almost 3626 with the dawn of structured network mail and shows no signs of 3627 abating. Advocates of rejection claim that attempted repairs are 3628 rarely completely adequate and that rejection of bad messages is the 3629 only way to get the offending software repaired. Advocates of 3630 "repair" or "deliver no matter what" argue that users prefer that 3631 mail go through it if at all possible and that there are significant 3632 market pressures in that direction. In practice, these market 3633 pressures may be more important to particular vendors than strict 3634 conformance to the standards, regardless of the preference of the 3635 actual developers. 3637 The problems associated with ill-formed messages were exacerbated by 3638 the introduction of the split-UA mail reading protocols (Post Office 3639 Protocol (POP) version 2 [14], Post Office Protocol (POP) version 3 3640 [23], IMAP version 2 [19], and PCMAIL [18]). These protocols 3641 encouraged the use of SMTP as a posting (message submission) 3642 protocol, and SMTP servers as relay systems for these client hosts 3643 (which are often only intermittently connected to the Internet). 3644 Historically, many of those client machines lacked some of the 3645 mechanisms and information assumed by SMTP (and indeed, by the mail 3646 format protocol, RFC 822 [13]). Some could not keep adequate track 3647 of time; others had no concept of time zones; still others could not 3648 identify their own names or addresses; and, of course, none could 3649 satisfy the assumptions that underlay RFC 822's conception of 3650 authenticated addresses. 3652 In response to these weak SMTP clients, many SMTP systems now 3653 complete messages that are delivered to them in incomplete or 3654 incorrect form. This strategy is generally considered appropriate 3655 when the server can identify or authenticate the client, and there 3656 are prior agreements between them. By contrast, there is at best 3657 great concern about fixes applied by a relay or delivery SMTP server 3658 that has little or no knowledge of the user or client machine. Many 3659 of these issues are addressed by using a separate protocol, such as 3660 that defined in RFC 6409 [42], for message submission, rather than 3661 using originating SMTP servers for that purpose. 3663 The following changes to a message being processed MAY be applied 3664 when necessary by an originating SMTP server, or one used as the 3665 target of SMTP as an initial posting (message submission) protocol: 3667 o Addition of a message-id field when none appears 3669 o Addition of a date, time, or time zone when none appears 3671 o Correction of addresses to proper FQDN format 3673 The less information the server has about the client, the less likely 3674 these changes are to be correct and the more caution and conservatism 3675 should be applied when considering whether or not to perform fixes 3676 and how. These changes MUST NOT be applied by an SMTP server that 3677 provides an intermediate relay function. 3679 In all cases, properly operating clients supplying correct 3680 information are preferred to corrections by the SMTP server. In all 3681 cases, documentation SHOULD be provided in trace header fields and/or 3682 header field comments for actions performed by the servers. 3684 7. Security Considerations 3685 7.1. Mail Security and Spoofing 3687 SMTP mail is inherently insecure in that it is feasible for even 3688 fairly casual users to negotiate directly with receiving and relaying 3689 SMTP servers and create messages that will trick a naive recipient 3690 into believing that they came from somewhere else. Constructing such 3691 a message so that the "spoofed" behavior cannot be detected by an 3692 expert is somewhat more difficult, but not sufficiently so as to be a 3693 deterrent to someone who is determined and knowledgeable. 3694 Consequently, as knowledge of Internet mail increases, so does the 3695 knowledge that SMTP mail inherently cannot be authenticated, or 3696 integrity checks provided, at the transport level. Real mail 3697 security lies only in end-to-end methods involving the message 3698 bodies, such as those that use digital signatures (see RFC 1847 [21] 3699 and, e.g., Pretty Good Privacy (PGP) in RFC 4880 [45] or Secure/ 3700 Multipurpose Internet Mail Extensions (S/MIME) in RFC 8551 [38]). 3702 Various protocol extensions and configuration options that provide 3703 authentication at the transport level (e.g., from an SMTP client to 3704 an SMTP server) improve somewhat on the traditional situation 3705 described above. However, in general, they only authenticate one 3706 server to another rather than a chain of relays and servers, much 3707 less authenticating users or user machines. Consequently, unless 3708 they are accompanied by careful handoffs of responsibility in a 3709 carefully designed trust environment, they remain inherently weaker 3710 than end-to-end mechanisms that use digitally signed messages rather 3711 than depending on the integrity of the transport system. 3713 Efforts to make it more difficult for users to set envelope return 3714 path and header "From" fields to point to valid addresses other than 3715 their own are largely misguided: they frustrate legitimate 3716 applications in which mail is sent by one user on behalf of another, 3717 in which error (or normal) replies should be directed to a special 3718 address, or in which a single message is sent to multiple recipients 3719 on different hosts. (Systems that provide convenient ways for users 3720 to alter these header fields on a per-message basis should attempt to 3721 establish a primary and permanent mailbox address for the user so 3722 that Sender header fields within the message data can be generated 3723 sensibly.) 3725 This specification does not further address the authentication issues 3726 associated with SMTP other than to advocate that useful functionality 3727 not be disabled in the hope of providing some small margin of 3728 protection against a user who is trying to fake mail. 3730 7.2. "Blind" Copies 3732 Addresses that do not appear in the message header section may appear 3733 in the RCPT commands to an SMTP server for a number of reasons. The 3734 two most common involve the use of a mailing address as a "list 3735 exploder" (a single address that resolves into multiple addresses) 3736 and the appearance of "blind copies". Especially when more than one 3737 RCPT command is present, and in order to avoid defeating some of the 3738 purpose of these mechanisms, SMTP clients and servers SHOULD NOT copy 3739 the full set of RCPT command arguments into the header section, 3740 either as part of trace header fields or as informational or private- 3741 extension header fields. [[CREF15: [rfc5321bis] [[Note in draft - 3742 Suggestion from 20070124 that got lost: delete "especially" and "the 3743 full set of" -- copying the first one can be as harmful as copying 3744 all of them, at least without verifying that the addresses do appear 3745 in the headers. See G.7.9 and ticket #15.]] Since this rule is often 3746 violated in practice, and cannot be enforced, sending SMTP systems 3747 that are aware of "bcc" use MAY find it helpful to send each blind 3748 copy as a separate message transaction containing only a single RCPT 3749 command. 3751 There is no inherent relationship between either "reverse" (from the 3752 MAIL command) or "forward" (RCPT) addresses in the SMTP transaction 3753 ("envelope") and the addresses in the header section. Receiving 3754 systems SHOULD NOT attempt to deduce such relationships and use them 3755 to alter the header section of the message for delivery. The popular 3756 "Apparently-to" header field is a violation of this principle as well 3757 as a common source of unintended information disclosure and SHOULD 3758 NOT be used. 3760 7.3. VRFY, EXPN, and Security 3762 As discussed in Section 3.5, individual sites may want to disable 3763 either or both of VRFY or EXPN for security reasons (see below). As 3764 a corollary to the above, implementations that permit this MUST NOT 3765 appear to have verified addresses that are not, in fact, verified. 3766 If a site disables these commands for security reasons, the SMTP 3767 server MUST return a 252 response, rather than a code that could be 3768 confused with successful or unsuccessful verification. 3770 Returning a 250 reply code with the address listed in the VRFY 3771 command after having checked it only for syntax violates this rule. 3772 Of course, an implementation that "supports" VRFY by always returning 3773 550 whether or not the address is valid is equally not in 3774 conformance. 3776 On the public Internet, the contents of mailing lists have become 3777 popular as an address information source for so-called "spammers." 3778 The use of EXPN to "harvest" addresses has increased as list 3779 administrators have installed protections against inappropriate uses 3780 of the lists themselves. However, VRFY and EXPN are still useful for 3781 authenticated users and within an administrative domain. For 3782 example, VRFY and EXPN are useful for performing internal audits of 3783 how email gets routed to check and to make sure no one is 3784 automatically forwarding sensitive mail outside the organization. 3785 Sites implementing SMTP authentication may choose to make VRFY and 3786 EXPN available only to authenticated requestors. Implementations 3787 SHOULD still provide support for EXPN, but sites SHOULD carefully 3788 evaluate the tradeoffs. 3790 Whether disabling VRFY provides any real marginal security depends on 3791 a series of other conditions. In many cases, RCPT commands can be 3792 used to obtain the same information about address validity. On the 3793 other hand, especially in situations where determination of address 3794 validity for RCPT commands is deferred until after the DATA command 3795 is received, RCPT may return no information at all, while VRFY is 3796 expected to make a serious attempt to determine validity before 3797 generating a response code (see discussion above). 3799 7.4. Mail Rerouting Based on the 251 and 551 Response Codes 3801 Before a client uses the 251 or 551 reply codes from a RCPT command 3802 to automatically update its future behavior (e.g., updating the 3803 user's address book), it should be certain of the server's 3804 authenticity. If it does not, it may be subject to a man in the 3805 middle attack. 3807 7.5. Information Disclosure in Announcements 3809 There has been an ongoing debate about the tradeoffs between the 3810 debugging advantages of announcing server type and version (and, 3811 sometimes, even server domain name) in the greeting response or in 3812 response to the HELP command and the disadvantages of exposing 3813 information that might be useful in a potential hostile attack. The 3814 utility of the debugging information is beyond doubt. Those who 3815 argue for making it available point out that it is far better to 3816 actually secure an SMTP server rather than hope that trying to 3817 conceal known vulnerabilities by hiding the server's precise identity 3818 will provide more protection. Sites are encouraged to evaluate the 3819 tradeoff with that issue in mind; implementations SHOULD minimally 3820 provide for making type and version information available in some way 3821 to other network hosts. 3823 7.6. Information Disclosure in Trace Fields 3825 In some circumstances, such as when mail originates from within a LAN 3826 whose hosts are not directly on the public Internet, trace 3827 ("Received") header fields produced in conformance with this 3828 specification may disclose host names and similar information that 3829 would not normally be available. This ordinarily does not pose a 3830 problem, but sites with special concerns about name disclosure should 3831 be aware of it. Also, the optional FOR clause should be supplied 3832 with caution or not at all when multiple recipients are involved lest 3833 it inadvertently disclose the identities of "blind copy" recipients 3834 to others. 3836 7.7. Information Disclosure in Message Forwarding 3838 As discussed in Section 3.4, use of the 251 or 551 reply codes to 3839 identify the replacement address associated with a mailbox may 3840 inadvertently disclose sensitive information. Sites that are 3841 concerned about those issues should ensure that they select and 3842 configure servers appropriately. 3844 7.8. Local Operational Requirement and Resistance to Attacks 3846 In recent years, there has been an increase of attacks on SMTP 3847 servers, either in conjunction with attempts to discover addresses 3848 for sending unsolicited messages or simply to make the servers 3849 inaccessible to others (i.e., as an application-level denial of 3850 service attack). There may also be important local circumstances 3851 that justify departures from some of the limits specified in this 3852 documents especially ones involving maximums or minimums. While the 3853 means of doing so are beyond the scope of this Standard, rational 3854 operational behavior requires that servers be permitted to detect 3855 such attacks and take action to defend themselves. For example, if a 3856 server determines that a large number of RCPT commands are being 3857 sent, most or all with invalid addresses, as part of such an attack, 3858 it would be reasonable for the server to close the connection after 3859 generating an appropriate number of 5yz (normally 550) replies. 3861 7.9. Scope of Operation of SMTP Servers 3863 It is a well-established principle that an SMTP server may refuse to 3864 accept mail for any operational or technical reason that makes sense 3865 to the site providing the server. However, cooperation among sites 3866 and installations makes the Internet possible. If sites take 3867 excessive advantage of the right to reject traffic, the ubiquity of 3868 email availability (one of the strengths of the Internet) will be 3869 threatened; considerable care should be taken and balance maintained 3870 if a site decides to be selective about the traffic it will accept 3871 and process. 3873 In recent years, use of the relay function through arbitrary sites 3874 has been used as part of hostile efforts to hide the actual origins 3875 of mail. Some sites have decided to limit the use of the relay 3876 function to known or identifiable sources, and implementations SHOULD 3877 provide the capability to perform this type of filtering. When mail 3878 is rejected for these or other policy reasons, a 550 code SHOULD be 3879 used in response to EHLO (or HELO), MAIL, or RCPT as appropriate. 3881 8. IANA Considerations 3883 IANA maintains three registries in support of this specification, all 3884 of which were created for RFC 2821 or earlier. This document expands 3885 the third one as specified below. The registry references listed are 3886 as of the time of publication; IANA does not guarantee the locations 3887 associated with the URLs. The registries are as follows: 3889 o The first, "Simple Mail Transfer Protocol (SMTP) Service 3890 Extensions" [49], consists of SMTP service extensions with the 3891 associated keywords, and, as needed, parameters and verbs. As 3892 specified in Section 2.2.2, no entry may be made in this registry 3893 that starts in an "X". Entries may be made only for service 3894 extensions (and associated keywords, parameters, or verbs) that 3895 are defined in Standards-Track or Experimental RFCs specifically 3896 approved by the IESG for this purpose. 3898 o The second registry, "Address Literal Tags" [50], consists of 3899 "tags" that identify forms of domain literals other than those for 3900 IPv4 addresses (specified in RFC 821 and in this document). The 3901 initial entry in that registry is for IPv6 addresses (specified in 3902 this document). Additional literal types require standardization 3903 before being used; none are anticipated at this time. 3905 o The third, "Mail Transmission Types" [49], established by RFC 821 3906 and renewed by this specification, is a registry of link and 3907 protocol identifiers to be used with the "via" and "with" 3908 subclauses of the time stamp ("Received:" header field) described 3909 in Section 4.4. Link and protocol identifiers in addition to 3910 those specified in this document may be registered only by 3911 standardization or by way of an RFC-documented, IESG-approved, 3912 Experimental protocol extension. This name space is for 3913 identification and not limited in size: the IESG is encouraged to 3914 approve on the basis of clear documentation and a distinct method 3915 rather than preferences about the properties of the method itself. 3917 An additional subsection has been added to the "VIA link types" 3918 and "WITH protocol types" subsections of this registry to contain 3919 registrations of "Additional-registered-clauses" as described 3920 above. The registry will contain clause names, a description, a 3921 summary of the syntax of the associated String, and a reference. 3922 As new clauses are defined, they may, in principle, specify 3923 creation of their own registries if the Strings consist of 3924 reserved terms or keywords rather than less restricted strings. 3925 As with link and protocol identifiers, additional clauses may be 3926 registered only by standardization or by way of an RFC-documented, 3927 IESG-approved, Experimental protocol extension. The additional 3928 clause name space is for identification and is not limited in 3929 size: the IESG is encouraged to approve on the basis of clear 3930 documentation, actual use or strong signs that the clause will be 3931 used, and a distinct requirement rather than preferences about the 3932 properties of the clause itself. 3934 In addition, if additional trace header fields (i.e., in addition to 3935 Return-path and Received) are ever created, those trace fields MUST 3936 be added to the IANA registry established by BCP 90 (RFC 3864) [9] 3937 for use with RFC 5322 [12]. 3939 9. Acknowledgments 3941 Many people contributed to the development of RFCs 2821 and 5321. 3942 Those documents should be consulted for those acknowledgments. 3944 Neither this document nor RFCs 2821 or 5321 would have been possible 3945 without the many contribution and insights of the late Jon Postel. 3946 Those contributions of course include the original specification of 3947 SMTP in RFC 821. A considerable quantity of text from RFC 821 still 3948 appears in this document as do several of Jon's original examples 3949 that have been updated only as needed to reflect other changes in the 3950 specification. 3952 The following filed errata against RFC 5321 that were not rejected at 3953 the time of submission: Jasen Betts, Adrien de Croy Guillaume Fortin- 3954 Debigare Roberto Javier Godoy, David Romerstein, Dominic Sayers, 3955 Rodrigo Speller, Alessandro Vesely, and Brett Watson. Some of those 3956 individuals made additional suggestions after the EMAILCORE WG was 3957 initiated. In addition to the above, several of whom continued to 3958 make other suggestons, specific suggestions that led to corrections 3959 and improvements in early versions of the current specification were 3960 received from Dave Crocker, Ned Freed, Arnt Gulbrandsen, Tony Hansen, 3961 Barry Leiba, Ivar Lumi, Pete Resnick, Hector Santos, Paul Smith and 3962 others. 3964 chetti contributed an analysis that clarified the ABNF productions 3965 that implicitly reference other documents. 3967 The EMAILCORE Working Group was chartered in September 2020 with 3968 Alexey Melnikov and Seth Blank as co-chairs. Todd Herr replaced Seth 3969 Blank early in 2021. Without their leadership and technical 3970 contributions, this document would never have been completed. 3972 10. References 3974 10.1. Normative References 3976 [1] Bradner, S., "Key words for use in RFCs to Indicate 3977 Requirement Levels", BCP 14, RFC 2119, 3978 DOI 10.17487/RFC2119, March 1997, 3979 . 3981 [2] American National Standards Institute (formerly United 3982 States of America Standards Institute), "USA Code for 3983 Information Interchange", ANSI X3.4-1968, 1968. 3985 ANSI X3.4-1968 has been replaced by newer versions with 3986 slight modifications, but the 1968 version remains 3987 definitive for the Internet. 3989 [3] Postel, J., "Simple Mail Transfer Protocol", STD 10, 3990 RFC 821, DOI 10.17487/RFC0821, August 1982, 3991 . 3993 [4] Mockapetris, P., "Domain names - implementation and 3994 specification", STD 13, RFC 1035, DOI 10.17487/RFC1035, 3995 November 1987, . 3997 [5] Braden, R., Ed., "Requirements for Internet Hosts - 3998 Application and Support", STD 3, RFC 1123, 3999 DOI 10.17487/RFC1123, October 1989, 4000 . 4002 [6] Klensin, J., Freed, N., and K. Moore, "SMTP Service 4003 Extension for Message Size Declaration", STD 10, RFC 1870, 4004 DOI 10.17487/RFC1870, November 1995, 4005 . 4007 [7] Vaudreuil, G., "Enhanced Mail System Status Codes", 4008 RFC 3463, DOI 10.17487/RFC3463, January 2003, 4009 . 4011 [8] Newman, C., "ESMTP and LMTP Transmission Types 4012 Registration", RFC 3848, DOI 10.17487/RFC3848, July 2004, 4013 . 4015 [9] Klyne, G., Nottingham, M., and J. Mogul, "Registration 4016 Procedures for Message Header Fields", BCP 90, RFC 3864, 4017 DOI 10.17487/RFC3864, September 2004, 4018 . 4020 [10] Hinden, R. and S. Deering, "IP Version 6 Addressing 4021 Architecture", RFC 4291, DOI 10.17487/RFC4291, February 4022 2006, . 4024 [11] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax 4025 Specifications: ABNF", STD 68, RFC 5234, 4026 DOI 10.17487/RFC5234, January 2008, 4027 . 4029 [12] Resnick, P., "Internet Message Format", RFC 5322, 4030 September 2008. 4032 10.2. Informative References 4034 [13] Crocker, D., "STANDARD FOR THE FORMAT OF ARPA INTERNET 4035 TEXT MESSAGES", STD 11, RFC 822, DOI 10.17487/RFC0822, 4036 August 1982, . 4038 [14] Butler, M., Postel, J., Chase, D., Goldberger, J., and J. 4039 Reynolds, "Post Office Protocol: Version 2", RFC 937, 4040 DOI 10.17487/RFC0937, February 1985, 4041 . 4043 [15] Postel, J. and J. Reynolds, "File Transfer Protocol", 4044 STD 9, RFC 959, DOI 10.17487/RFC0959, October 1985, 4045 . 4047 [16] Partridge, C., "Mail routing and the domain system", 4048 STD 10, RFC 974, DOI 10.17487/RFC0974, January 1986, 4049 . 4051 [17] Partridge, C., "Duplicate messages and SMTP", RFC 1047, 4052 DOI 10.17487/RFC1047, February 1988, 4053 . 4055 [18] Lambert, M., "PCMAIL: A distributed mail system for 4056 personal computers", RFC 1056, DOI 10.17487/RFC1056, June 4057 1988, . 4059 [19] Crispin, M., "Interactive Mail Access Protocol: Version 4060 2", RFC 1176, DOI 10.17487/RFC1176, August 1990, 4061 . 4063 [20] Durand, A. and F. Dupont, "SMTP 521 Reply Code", RFC 1846, 4064 DOI 10.17487/RFC1846, September 1995, 4065 . 4067 [21] Galvin, J., Murphy, S., Crocker, S., and N. Freed, 4068 "Security Multiparts for MIME: Multipart/Signed and 4069 Multipart/Encrypted", RFC 1847, DOI 10.17487/RFC1847, 4070 October 1995, . 4072 [22] Klensin, J., Freed, N., Rose, M., Stefferud, E., and D. 4073 Crocker, "SMTP Service Extensions", STD 10, RFC 1869, 4074 DOI 10.17487/RFC1869, November 1995, 4075 . 4077 [23] Myers, J. and M. Rose, "Post Office Protocol - Version 3", 4078 STD 53, RFC 1939, DOI 10.17487/RFC1939, May 1996, 4079 . 4081 [24] De Winter, J., "SMTP Service Extension for Remote Message 4082 Queue Starting", RFC 1985, DOI 10.17487/RFC1985, August 4083 1996, . 4085 [25] Freed, N. and N. Borenstein, "Multipurpose Internet Mail 4086 Extensions (MIME) Part One: Format of Internet Message 4087 Bodies", RFC 2045, DOI 10.17487/RFC2045, November 1996, 4088 . 4090 [26] Moore, K., "MIME (Multipurpose Internet Mail Extensions) 4091 Part Three: Message Header Extensions for Non-ASCII Text", 4092 RFC 2047, DOI 10.17487/RFC2047, November 1996, 4093 . 4095 [27] Kille, S., "MIXER (Mime Internet X.400 Enhanced Relay): 4096 Mapping between X.400 and RFC 822/MIME", RFC 2156, 4097 DOI 10.17487/RFC2156, January 1998, 4098 . 4100 [28] Elz, R. and R. Bush, "Clarifications to the DNS 4101 Specification", RFC 2181, DOI 10.17487/RFC2181, July 1997, 4102 . 4104 [29] Freed, N. and K. Moore, "MIME Parameter Value and Encoded 4105 Word Extensions: Character Sets, Languages, and 4106 Continuations", RFC 2231, DOI 10.17487/RFC2231, November 4107 1997, . 4109 [30] Klensin, J., Ed., "Simple Mail Transfer Protocol", 4110 RFC 2821, DOI 10.17487/RFC2821, April 2001, 4111 . 4113 [31] Freed, N., "SMTP Service Extension for Command 4114 Pipelining", STD 60, RFC 2920, DOI 10.17487/RFC2920, 4115 September 2000, . 4117 [32] Freed, N., "Behavior of and Requirements for Internet 4118 Firewalls", RFC 2979, DOI 10.17487/RFC2979, October 2000, 4119 . 4121 [33] Vaudreuil, G., "SMTP Service Extensions for Transmission 4122 of Large and Binary MIME Messages", RFC 3030, 4123 DOI 10.17487/RFC3030, December 2000, 4124 . 4126 [34] Moore, K., "Simple Mail Transfer Protocol (SMTP) Service 4127 Extension for Delivery Status Notifications (DSNs)", 4128 RFC 3461, DOI 10.17487/RFC3461, January 2003, 4129 . 4131 [35] Moore, K. and G. Vaudreuil, "An Extensible Message Format 4132 for Delivery Status Notifications", RFC 3464, 4133 DOI 10.17487/RFC3464, January 2003, 4134 . 4136 [36] Crispin, M., "INTERNET MESSAGE ACCESS PROTOCOL - VERSION 4137 4rev1", RFC 3501, DOI 10.17487/RFC3501, March 2003, 4138 . 4140 [37] Hansen, T., Ed. and A. Melnikov, Ed., "Message Disposition 4141 Notification", STD 85, RFC 8098, DOI 10.17487/RFC8098, 4142 February 2017, . 4144 [38] Schaad, J., Ramsdell, B., and S. Turner, "Secure/ 4145 Multipurpose Internet Mail Extensions (S/MIME) Version 4.0 4146 Message Specification", RFC 8551, DOI 10.17487/RFC8551, 4147 April 2019, . 4149 [39] Nakamura, M. and J. Hagino, "SMTP Operational Experience 4150 in Mixed IPv4/v6 Environments", RFC 3974, 4151 DOI 10.17487/RFC3974, January 2005, 4152 . 4154 [40] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 4155 Resource Identifier (URI): Generic Syntax", STD 66, 4156 RFC 3986, DOI 10.17487/RFC3986, January 2005, 4157 . 4159 [41] Kitterman, S., "Sender Policy Framework (SPF) for 4160 Authorizing Use of Domains in Email, Version 1", RFC 7208, 4161 DOI 10.17487/RFC7208, April 2014, 4162 . 4164 [42] Gellens, R. and J. Klensin, "Message Submission for Mail", 4165 STD 72, RFC 6409, DOI 10.17487/RFC6409, November 2011, 4166 . 4168 [43] Fenton, J., "Analysis of Threats Motivating DomainKeys 4169 Identified Mail (DKIM)", RFC 4686, DOI 10.17487/RFC4686, 4170 September 2006, . 4172 [44] Crocker, D., Ed., Hansen, T., Ed., and M. Kucherawy, Ed., 4173 "DomainKeys Identified Mail (DKIM) Signatures", STD 76, 4174 RFC 6376, DOI 10.17487/RFC6376, September 2011, 4175 . 4177 [45] Callas, J., Donnerhacke, L., Finney, H., Shaw, D., and R. 4178 Thayer, "OpenPGP Message Format", RFC 4880, 4179 DOI 10.17487/RFC4880, November 2007, 4180 . 4182 [46] Hansen, T. and J. Klensin, "A Registry for SMTP Enhanced 4183 Mail System Status Codes", BCP 138, RFC 5248, 4184 DOI 10.17487/RFC5248, June 2008, 4185 . 4187 [47] Klensin, J., Freed, N., Rose, M., and D. Crocker, Ed., 4188 "SMTP Service Extension for 8-bit MIME Transport", STD 71, 4189 RFC 6152, DOI 10.17487/RFC6152, March 2011, 4190 . 4192 [48] Klensin, J., "SMTP 521 and 556 Reply Codes", RFC 7504, 4193 DOI 10.17487/RFC7504, June 2015, 4194 . 4196 [49] Internet Assigned Number Authority (IANA), "IANA Mail 4197 Parameters", 2007, 4198 . 4200 [50] Internet Assigned Number Authority (IANA), "Address 4201 Literal Tags", 2007, 4202 . 4204 [51] Levine, J. and M. Delany, "A "Null MX" No Service Resource 4205 Record for Domains that Accept No Mail", September 2014, 4206 . 4209 [52] RFC Editor, "RFC Errata - RFC 5321", 2019, 4210 . 4212 Captured 2019-11-19 4214 [53] IANA, "SMTP Service Extensions", 2021, 4215 . 4218 Notes in draft: RFC Editor: Please adjust date field to 4219 reflect whatever you want for a registry that is updated 4220 periodically. IANA: Please determine if the above URL is 4221 a sufficiently stable reference and adjust as appropriate 4222 if it is not. 4224 Appendix A. TCP Transport Service 4226 The TCP connection supports the transmission of 8-bit bytes. The 4227 SMTP data is 7-bit ASCII characters. Each character is transmitted 4228 as an 8-bit byte with the high-order bit cleared to zero. Service 4229 extensions may modify this rule to permit transmission of full 8-bit 4230 data bytes as part of the message body, or, if specifically designed 4231 to do so, in SMTP commands or responses. 4233 Appendix B. Generating SMTP Commands from RFC 822 Header Fields 4235 Some systems use an RFC 822 header section (only) in a mail 4236 submission protocol, or otherwise generate SMTP commands from RFC 822 4237 header fields when such a message is handed to an MTA from a UA. 4238 While the MTA-UA protocol is a private matter, not covered by any 4239 Internet Standard, there are problems with this approach. For 4240 example, there have been repeated problems with proper handling of 4241 "bcc" copies and redistribution lists when information that 4242 conceptually belongs to the mail envelope is not separated early in 4243 processing from header field information (and kept separate). 4245 It is recommended that the UA provide its initial ("submission 4246 client") MTA with an envelope separate from the message itself. 4247 However, if the envelope is not supplied, SMTP commands SHOULD be 4248 generated as follows: 4250 1. Each recipient address from a TO, CC, or BCC header field SHOULD 4251 be copied to a RCPT command (generating multiple message copies 4252 if that is required for queuing or delivery). This includes any 4253 addresses listed in a RFC 822 "group". Any BCC header fields 4254 SHOULD then be removed from the header section. Once this 4255 process is completed, the remaining header fields SHOULD be 4256 checked to verify that at least one TO, CC, or BCC header field 4257 remains. If none do, then a BCC header field with no additional 4258 information SHOULD be inserted as specified in [12]. 4260 2. The return address in the MAIL command SHOULD, if possible, be 4261 derived from the system's identity for the submitting (local) 4262 user, and the "From:" header field otherwise. If there is a 4263 system identity available, it SHOULD also be copied to the Sender 4264 header field if it is different from the address in the From 4265 header field. (Any Sender header field that was already there 4266 SHOULD be removed.) Systems may provide a way for submitters to 4267 override the envelope return address, but may want to restrict 4268 its use to privileged users. This will not prevent mail forgery, 4269 but may lessen its incidence; see Section 7.1. 4271 When an MTA is being used in this way, it bears responsibility for 4272 ensuring that the message being transmitted is valid. The mechanisms 4273 for checking that validity, and for handling (or returning) messages 4274 that are not valid at the time of arrival, are part of the MUA-MTA 4275 interface and not covered by this specification. 4277 A submission protocol based on Standard RFC 822 information alone 4278 MUST NOT be used to gateway a message from a foreign (non-SMTP) mail 4279 system into an SMTP environment. Additional information to construct 4280 an envelope must come from some source in the other environment, 4281 whether supplemental header fields or the foreign system's envelope. 4283 Attempts to gateway messages using only their header "To" and "Cc" 4284 fields have repeatedly caused mail loops and other behavior adverse 4285 to the proper functioning of the Internet mail environment. These 4286 problems have been especially common when the message originates from 4287 an Internet mailing list and is distributed into the foreign 4288 environment using envelope information. When these messages are then 4289 processed by a header-section-only remailer, loops back to the 4290 Internet environment (and the mailing list) are almost inevitable. 4292 Appendix C. Source Routes 4294 Historically, the was a reverse source routing list of 4295 hosts and a source mailbox. The first host in the was 4296 historically the host sending the MAIL command; today, source routes 4297 SHOULD NOT appear in the reverse-path. Similarly, the 4298 may be a source routing lists of hosts and a destination mailbox. 4299 However, in general, the SHOULD contain only a mailbox 4300 and domain name, relying on the domain name system to supply routing 4301 information if required. The use of source routes is deprecated (see 4302 Appendix F.2); while servers MUST be prepared to receive and handle 4303 them as discussed in Section 3.3 and Appendix F.2, clients SHOULD NOT 4304 transmit them and this section is included in the current 4305 specification only to provide context. It has been modified somewhat 4306 from the material in RFC 821 to prevent server actions that might 4307 confuse clients or subsequent servers that do not expect a full 4308 source route implementation. 4310 Historically, for relay purposes, the forward-path may have been a 4311 source route of the form "@ONE,@TWO:JOE@THREE", where ONE, TWO, and 4312 THREE MUST be fully-qualified domain names. This form was used to 4313 emphasize the distinction between an address and a route. The 4314 mailbox (here, JOE@THREE) is an absolute address, and the route is 4315 information about how to get there. The two concepts should not be 4316 confused. 4318 If source routes are used contrary to requirements and 4319 recommendations elsewhere in this specfiication, RFC 821 and the text 4320 below should be consulted for the mechanisms for constructing and 4321 updating the forward-path. A server that is reached by means of a 4322 source route (e.g., its domain name appears first in the list in the 4323 forward-path) MUST remove its domain name from any forward-paths in 4324 which that domain name appears before forwarding the message and MAY 4325 remove all other source routing information. The reverse-path SHOULD 4326 NOT be updated by servers conforming to this specification. 4328 Notice that the forward-path and reverse-path appear in the SMTP 4329 commands and replies, but not necessarily in the message. That is, 4330 there is no need for these paths and especially this syntax to appear 4331 in the "To:" , "From:", "CC:", etc. fields of the message header 4332 section. Conversely, SMTP servers MUST NOT derive final message 4333 routing information from message header fields. 4335 When the list of hosts is present despite the recommendations and 4336 requirements above, it is a "reverse" source route and indicates that 4337 the mail was relayed through each host on the list (the first host in 4338 the list was the most recent relay). This list is used as a source 4339 route to return non-delivery notices to the sender. If, contrary to 4340 the recommendations here, a relay host adds itself to the beginning 4341 of the list, it MUST use its name as known in the transport 4342 environment to which it is relaying the mail rather than that of the 4343 transport environment from which the mail came (if they are 4344 different). Note that a situation could easily arise in which some 4345 relay hosts add their names to the reverse source route and others do 4346 not, generating discontinuities in the routing list. This is another 4347 reason why servers needing to return a message SHOULD ignore the 4348 source route entirely and simply use the domain as specified in the 4349 Mailbox. 4351 Appendix D. Scenarios 4353 This section presents complete scenarios of several types of SMTP 4354 sessions. In the examples, "C:" indicates what is said by the SMTP 4355 client, and "S:" indicates what is said by the SMTP server. 4357 D.1. A Typical SMTP Transaction Scenario 4359 This SMTP example shows mail sent by Smith at host bar.com, and to 4360 Jones, Green, and Brown at host foo.com. Here we assume that host 4361 bar.com contacts host foo.com directly. The mail is accepted for 4362 Jones and Brown. Green does not have a mailbox at host foo.com. 4364 S: 220 foo.com Simple Mail Transfer Service Ready 4365 C: EHLO bar.com 4366 S: 250-foo.com greets bar.com 4367 S: 250-8BITMIME 4368 S: 250-SIZE 4369 S: 250-DSN 4370 S: 250 HELP 4371 C: MAIL FROM: 4372 S: 250 OK 4373 C: RCPT TO: 4374 S: 250 OK 4375 C: RCPT TO: 4376 S: 550 No such user here 4377 C: RCPT TO: 4378 S: 250 OK 4379 C: DATA 4380 S: 354 Start mail input; end with . 4381 C: Blah blah blah... 4382 C: ...etc. etc. etc. 4383 C: . 4384 S: 250 OK 4385 C: QUIT 4386 S: 221 foo.com Service closing transmission channel 4388 D.2. Aborted SMTP Transaction Scenario 4390 S: 220 foo.com Simple Mail Transfer Service Ready 4391 C: EHLO bar.com 4392 S: 250-foo.com greets bar.com 4393 S: 250-8BITMIME 4394 S: 250-SIZE 4395 S: 250-DSN 4396 S: 250 HELP 4397 C: MAIL FROM: 4398 S: 250 OK 4399 C: RCPT TO: 4400 S: 250 OK 4401 C: RCPT TO: 4402 S: 550 No such user here 4403 C: RSET 4404 S: 250 OK 4405 C: QUIT 4406 S: 221 foo.com Service closing transmission channel 4408 D.3. Relayed Mail Scenario 4410 Step 1 -- Source Host to Relay Host 4412 The source host performs a DNS lookup on XYZ.COM (the destination 4413 address) and finds DNS MX records specifying xyz.com as the best 4414 preference and foo.com as a lower preference. It attempts to open a 4415 connection to xyz.com and fails. It then opens a connection to 4416 foo.com, with the following dialogue: 4418 S: 220 foo.com Simple Mail Transfer Service Ready 4419 C: EHLO bar.com 4420 S: 250-foo.com greets bar.com 4421 S: 250-8BITMIME 4422 S: 250-SIZE 4423 S: 250-DSN 4424 S: 250 HELP 4425 C: MAIL FROM: 4426 S: 250 OK 4427 C: RCPT TO: 4428 S: 250 OK 4429 C: DATA 4430 S: 354 Start mail input; end with . 4431 C: Date: Thu, 21 May 1998 05:33:29 -0700 4432 C: From: John Q. Public 4433 C: Subject: The Next Meeting of the Board 4434 C: To: Jones@xyz.com 4435 C: 4436 C: Bill: 4437 C: The next meeting of the board of directors will be 4438 C: on Tuesday. 4439 C: John. 4440 C: . 4441 S: 250 OK 4442 C: QUIT 4443 S: 221 foo.com Service closing transmission channel 4445 Step 2 -- Relay Host to Destination Host 4447 foo.com, having received the message, now does a DNS lookup on 4448 xyz.com. It finds the same set of MX records, but cannot use the one 4449 that points to itself (or to any other host as a worse preference). 4450 It tries to open a connection to xyz.com itself and succeeds. Then 4451 we have: 4453 S: 220 xyz.com Simple Mail Transfer Service Ready 4454 C: EHLO foo.com 4455 S: 250 xyz.com is on the air 4456 C: MAIL FROM: 4457 S: 250 OK 4458 C: RCPT TO: 4459 S: 250 OK 4460 C: DATA 4461 S: 354 Start mail input; end with . 4462 C: Received: from bar.com by foo.com ; Thu, 21 May 1998 4463 C: 05:33:29 -0700 4464 C: Date: Thu, 21 May 1998 05:33:29 -0700 4465 C: From: John Q. Public 4466 C: Subject: The Next Meeting of the Board 4467 C: To: Jones@xyz.com 4468 C: 4469 C: Bill: 4470 C: The next meeting of the board of directors will be 4471 C: on Tuesday. 4472 C: John. 4473 C: . 4474 S: 250 OK 4475 C: QUIT 4476 S: 221 xyz.com Service closing transmission channel 4478 D.4. Verifying and Sending Scenario 4480 S: 220 foo.com Simple Mail Transfer Service Ready 4481 C: EHLO bar.com 4482 S: 250-foo.com greets bar.com 4483 S: 250-8BITMIME 4484 S: 250-SIZE 4485 S: 250-DSN 4486 S: 250-VRFY 4487 S: 250 HELP 4488 C: VRFY Crispin 4489 S: 250 Mark Crispin 4490 C: MAIL FROM: 4491 S: 250 OK 4492 C: RCPT TO: 4493 S: 250 OK 4494 C: DATA 4495 S: 354 Start mail input; end with . 4496 C: Blah blah blah... 4497 C: ...etc. etc. etc. 4498 C: . 4499 S: 250 OK 4500 C: QUIT 4501 S: 221 foo.com Service closing transmission channel 4503 Appendix E. Other Gateway Issues 4505 In general, gateways between the Internet and other mail systems 4506 SHOULD attempt to preserve any layering semantics across the 4507 boundaries between the two mail systems involved. Gateway- 4508 translation approaches that attempt to take shortcuts by mapping 4509 (such as mapping envelope information from one system to the message 4510 header section or body of another) have generally proven to be 4511 inadequate in important ways. Systems translating between 4512 environments that do not support both envelopes and a header section 4513 and Internet mail must be written with the understanding that some 4514 information loss is almost inevitable. 4516 Appendix F. Deprecated Features of RFC 821 4518 A few features of RFC 821 have proven to be problematic and SHOULD 4519 NOT be used in Internet mail. Some of these features were deprecated 4520 in RFC 2821 in 2001; source routing and two-digit years in dates were 4521 deprecated by RFC 1123 in 1989. Of the domain literal forms, RFC 4522 1123 required support only for the dotted decimal form. With the 4523 possible exception of old, hardware-embedded, applications, there is 4524 no longer any excuse for these features to appear on the contemporary 4525 Internet. 4527 F.1. TURN 4529 This command, described in RFC 821, raises important security issues 4530 since, in the absence of strong authentication of the host requesting 4531 that the client and server switch roles, it can easily be used to 4532 divert mail from its correct destination. Its use is deprecated; 4533 SMTP systems SHOULD NOT use it unless the server can authenticate the 4534 client. 4536 F.2. Source Routing 4538 RFC 821 utilized the concept of explicit source routing to get mail 4539 from one host to another via a series of relays. The requirement to 4540 utilize source routes in regular mail traffic was eliminated by the 4541 introduction of the domain name system "MX" record and the last 4542 significant justification for them was eliminated by the 4543 introduction, in RFC 1123, of a clear requirement that addresses 4544 following an "@" must all be fully-qualified domain names. 4545 Consequently, the only remaining justifications for the use of source 4546 routes are support for very old SMTP clients or MUAs and in mail 4547 system debugging. They can, however, still be useful in the latter 4548 circumstance and for routing mail around serious, but temporary, 4549 problems such as problems with the relevant DNS records. 4551 SMTP servers MUST continue to accept source route syntax as specified 4552 in the main body of this document and in RFC 1123. They MAY, if 4553 necessary, ignore the routes and utilize only the target domain in 4554 the address. If they do utilize the source route, the message MUST 4555 be sent to the first domain shown in the address. In particular, a 4556 server MUST NOT guess at shortcuts within the source route. 4558 Clients SHOULD NOT utilize explicit source routing except under 4559 unusual circumstances, such as debugging or potentially relaying 4560 around firewall or mail system configuration errors. 4562 F.3. HELO 4564 As discussed in Sections 3.1 and 4.1.1, EHLO SHOULD be used rather 4565 than HELO when the server will accept the former. Servers MUST 4566 continue to accept and process HELO in order to support older 4567 clients. 4569 F.4. #-literals 4571 RFC 821 provided for specifying an Internet address as a decimal 4572 integer host number prefixed by a pound sign, "#". In practice, that 4573 form has been obsolete since the introduction of TCP/IP. It is 4574 deprecated and MUST NOT be used. 4576 F.5. Dates and Years 4578 When dates are inserted into messages by SMTP clients or servers 4579 (e.g., in trace header fields), four-digit years MUST BE used. Two- 4580 digit years are deprecated; three-digit years were never permitted in 4581 the Internet mail system. 4583 F.6. Sending versus Mailing 4585 In addition to specifying a mechanism for delivering messages to 4586 user's mailboxes, RFC 821 provided additional, optional, commands to 4587 deliver messages directly to the user's terminal screen. These 4588 commands (SEND, SAML, SOML) were rarely implemented, and changes in 4589 workstation technology and the introduction of other protocols may 4590 have rendered them obsolete even where they are implemented. 4592 [[5321bis Editor's Note: does this need a stronger reference to 821, 4593 2821, and/or 5321? Also, is anything else needed given the removal 4594 of these commands and comments about, e.g., their opening mail 4595 transaction sessions, from the mail body of the text?]] 4596 Clients SHOULD NOT provide SEND, SAML, or SOML as services. Servers 4597 MAY implement them. If they are implemented by servers, the 4598 implementation model specified in RFC 821 MUST be used and the 4599 command names MUST be published in the response to the EHLO command. 4601 Appendix G. Other Outstanding Issues 4603 [[RFC Editor: Please remove this section before publication.]] 4605 In December 2019, an issue was raised on the ietf-smtp@ietf.org list 4606 that led to a broad discussion of ways in which existing practice had 4607 diverged from the specifications and recommendations of RFC 5321 in 4608 the more than eleven years since it was published (some of those 4609 issues probably affect the boundary between RFC 5321 and 5322 and 4610 hence the latter as well). In most cases, those divergences call for 4611 revision of the Technical Specification to match the practice, 4612 clarification of the specification text in other ways, or a more 4613 comprehensive explanation of why the practices recommended by the 4614 specification should really be followed. 4616 Those discussions raised two other issues, which were that 4618 o The publication of the Submission Server specification of RFC 6409 4619 in November 2011 may not have been fully reflected in RFC 5321 4620 (despite the even earlier publication of RFC 4409) and 4622 o There may be inconsistencies between the July 2009 Internet Mail 4623 Architecture description of RFC 5598 and the model described in 4624 RFC 5321. The issue called out in Appendix G.3 below may be an 4625 example of one of those inconsistencies. 4627 Those discrepancies should be identified and discussed and decisions 4628 made to fix them (and where) or to ignore them and let them continue. 4630 There has also been discussion on the mailing list, perhaps amounting 4631 to very rough consensus, that any revision of RFC 5321 and/or 5322 4632 should be accompanied by a separate Applicability Statement document 4633 that would make recommendations about applicability or best practices 4634 in particular areas rather than trying to get everything into the two 4635 technical specifications. This appendix does not attempt to identify 4636 which issues should get which treatment. 4638 This work is now (starting in the last half of 2020) being considered 4639 in the EMAILCORE WG. This appendix will act as a temporary record of 4640 issues that should be discussed and decided upon before a revised 4641 SMTP specification (or a related Applicability Statement) is 4642 published, issues that have not been reflected in errata (see 4643 Appendix H.1 below for those covered by errata). 4645 Ticket numbers listed below reference the list in 4646 https://trac.ietf.org/trac/emailcore/report/1 . 4648 G.1. IP Address literals 4650 The specification is unclear about whether IP address literals, 4651 particularly IP address literals used as arguments to the EHLO 4652 command, are required to be accepted or whether they are allowed to 4653 be rejected as part of the general "operational necessity" exception. 4654 Some have suggested that rejection of them is so common as an anti- 4655 spam measure that the use of such literals should be deprecated 4656 entirely in the specification, others that the are still useful and 4657 used and/or that, whatever is said about IP address literals within 4658 an SMTP session (e.g., in MAIL or RCPT commands), they should 4659 continue to be allowed (and required) in EHLO. 4660 Ticket #1. 4662 G.2. Repeated Use of EHLO 4664 While the specification says that an SMTP client's sending EHLO again 4665 after it has been issued (starting an SMTP session and treats it as 4666 if RSET had been sent (closing the session) followed by EHLO, there 4667 are apparently applications, at least some of them involving setting 4668 up of secure connections, in which the second EHLO is required and 4669 does not imply RSET. Does the specification need to be adjusted to 4670 reflect or call out those cases? 4672 After extended discussion in October 2020, it appears that the 4673 easiest fix to these problems is to clarify the conditions for 4674 termination of a mail transaction in Section 3.3 and to clearly 4675 specify the effect of a second (or subsequent) EHLO command in 4676 Section 4.1.4. 4677 See also Appendix G.7.4. 4678 Ticket #2. Both changes have been made in draft-ietf-emailcore- 4679 rfc5321bis-01. 4681 G.3. Meaning of "MTA" and Related Terminology 4683 A terminology issue has come up about what the term "MTA" actually 4684 refers to, a question that became at least slightly more complicated 4685 when we formalized RFC 6409 Submission Servers. Does the document 4686 need to be adjusted to be more clear about this topic? Note that the 4687 answer may interact with the question asked in Section 2 above. 4688 Possibly along the same lines, RFC 2821 changed the RFC 821 4689 terminology from "sender-SMTP" and "receiver-SMTP" to "SMTP client" 4690 and "SMTP server" respectively. As things have evolved, it is 4691 possible that newer terminology is a source of confusion and that the 4692 terminology should be changed back, something that also needs 4693 discussion. 4694 Ticket #3. 4696 G.4. Originator, or Originating System, Authentication 4698 Should RFC 5321bis address authentication and related issues or 4699 should Section 3.9 or other text be reshaped (in addition to or 4700 instead of the comment on that section) to lay a better foundation 4701 for such work, either in the context of mailing lists or more 4702 generally? 4703 This may interact with Erratum 4055 and Ticket #30 below. 4705 G.5. Remove or deprecate the work-around from code 552 to 452 4707 The suggestion in Section 4.5.3.1.10 may have outlived its usefulness 4708 and/or be inconsistent with current practice. Should it be removed 4709 and/or explicitly deprecated? 4710 Ticket #5. 4712 SHOULD requirement removed. 4714 G.6. Clarify where the protocol stands with respect to submission and 4715 TLS issues 4717 1. submission on port 587 4719 2. submission on port 465 4721 3. TLS relay on a port different from 25 (whenever) 4723 4. Recommendations about general use of transport layer (hop by hop) 4724 security, particularly encryption including consideration of RFC 4725 8314. 4727 G.7. Probably-substantive Discussion Topics Identified in Other Ways 4729 The following issues were identified as a group in the opening Note 4730 but called out specifically only in embedded CREF comments in 4731 versions of this draft prior to the first EMAILCORE version. 4733 G.7.1. Issues with 521, 554, and 556 codes 4735 See new Section 4.2.4.2. More text may be needed, there or 4736 elsewhere, about choices of codes in response to initial opening and 4737 to EHLO, especially to deal with selective policy rejections. 4738 Ticket #6. 4740 G.7.2. SMTP Model, terminology, and relationship to RFC 5598 4742 CREF comment in Section 2, CREF comment in Section 2.3.10, and 4743 comments in the introductory portion of Appendix G. 4745 G.7.3. Resolvable FQDNs and private domain names 4747 Multiple CREF comments in Section 2.3.5 4748 Tickets #9, #10 and #41. 4750 Ticket #41 marked "closed no change", per email 2021-0405. 4752 G.7.4. Possible clarification about mail transactions and transaction 4753 state 4755 CREF comment in Section 3.3 and also reference in Section 4.1.4 4756 Ticket #11. 4758 [[CREF16: See correspondence on this ticket 2021-07-06 through 4759 2021-07-09.]] 4761 G.7.5. Issues with mailing lists, aliases, and forwarding 4763 CREF comment in Section 3.9. May also want to note forwarding as an 4764 email address portability issue. Note that, if changes are made in 4765 this area, they should be kept consistent with the description and 4766 discussion of the 251 and 551 in Section 4.2 and Section 3.5 as well 4767 as Section 3.4 to avoid introducing inconsistencies. In addition, 4768 there are some terminology issues about the use of the term "lists", 4769 identified in erratum 1820, that should be reviewed after any more 4770 substantive changes are made to the relevant sections. 4771 Ticket #12 and Ticket #34. 4773 G.7.6. Requirements for domain name and/or IP address in EHLO 4775 CREF comment in Section 4.1.4 4776 Ticket #19. 4778 G.7.7. Does the 'first digit only' and/or non-listed reply code text 4779 need clarification? 4781 Resolved. Text in Section 4.2 changed 2021-02-08 and CREF comment in 4782 Section 4.3.1 removed. 4784 Perhaps unresolved -- ongoing discussion on mailing list after IETF 4785 110. 4786 Ticket #13. 4788 G.7.8. Size limits 4790 Once a decision is made about line length rules for RFC 5322bis, 4791 review the size limit discussions in this document, particularly the 4792 CREF comment (Note in Draft) at the end of the introductory material 4793 to Section 4.5.3 to be sure this document says what we want it to 4794 say. (See the additional question about minimum quantities, etc., in 4795 Appendix G.7.19.) 4796 Ticket #14 and maybe Ticket #38. 4798 G.7.9. Discussion of 'blind' copies and RCPT 4800 CREF comment in Section 7.2. May also need to discussion whether 4801 that terminology is politically incorrect and suggest a replacement. 4802 Ticket #15. 4804 G.7.10. Further clarifications needed to source routes? 4806 The current text largely deprecates the use of source routes but 4807 suggests that servers continue to support them. Is additional work 4808 needed in this area? See CREF comment in Appendix C 4809 Ticket #17. 4811 G.7.11. Should 1yz Be Revisited? 4813 RFC 5321 depreciated the "positive preliminary reply" response code 4814 category with first digit "1", so that the first digit of valid SMTP 4815 response codes must be 2, 3, 4, or 5. It has been suggested (see 4816 mail from Hector Santos with Subject "SMTP Reply code 1yz Positive 4817 Preliminary reply", March 5, 2020 12:56 -0500, on the SMTP list) that 4818 these codes should be reinstated to deal with some situations that 4819 became more plausible after 5321 was published. Do we need to take 4820 this back up? 4821 Ticket #18. 4823 G.7.12. Review Timeout Specifications 4825 RFC 5321 (and its predecessors going back to 821) specify minimum 4826 periods for client and server to wait before timing out. Are those 4827 intervals still appropriate in a world of faster processors and 4828 faster networks? Should they be updated and revised? Or should more 4829 qualifying language be added? 4830 Ticket #16. 4832 G.7.13. Possible SEND, SAML, SOML Loose End 4834 Per discussion (and Ticket #20), the text about SEND, SAML, and SOML 4835 has been removed from the main body of the document so that the only 4836 discussion of them now appears in Appendix F.6. Per the editor's 4837 note in that appendix, is any further discussion needed? 4839 G.7.14. Abstract Update 4841 Does the Abstract need to be modified in the light of RFC 6409 or 4842 other changes? 4844 G.7.15. Informative References to MIME and/or Message Submission 4846 Should RFC 2045 (MIME) and/or RFC 6409 (Message Submission) be 4847 referenced at the end of Section 1.2? 4849 G.7.16. Mail Transaction Discussion 4851 Does the discussion of mail transactions need more work (see CREF in 4852 Section 3.3.)? 4854 G.7.17. Hop-by-hop Authentication and/or Encryption 4856 Should this document discuss hop-by-hop authentication or, for that 4857 matter, encryption? (See CREF in Section 2.) 4859 G.7.18. More Text About 554 Given 521, etc. 4861 Does reply code 554 need additional or different explanation in the 4862 light of the addition of the new 521 code and/or the new (in 5321bis 4863 Section 4.2.4.2? (See CREF in Section 4.2.3.) 4865 G.7.19. Minimum Lengths and Quantities 4867 Are the minimum lengths and quantities specified in Section 4.5.3 4868 still appropriate or do they need adjusting? (See CREF at the 4869 beginning of that section.) Also note potential interaction with the 4870 proposed LIMITS SMTP extension (draft-freed-smtp-limits) which may 4871 make this question OBE. 4873 G.8. Enhanced Reply Codes and DSNs 4875 Enhanced Mail System Status Codes (RFC 3463) [7] were added to SMTP 4876 before RFC 5321 was published and are now, together with a 4877 corresponding registry [46], widely deployed and in extensive use in 4878 the network. Similar, the structure and extensions options for 4879 Delivery Status Notifications [35] is implemented, deployed, and in 4880 wide use. Is it time to fold all or part of those mature 4881 specifications into the SMTP spec or at least to mention and 4882 normatively reference them? And, as an aside, do those specs need 4883 work or, if they are kept separate, is it time to move them to 4884 Internet Standard? 4886 At least one of the current references to RFC 3463 indicates that it 4887 SHOULD be used. That presumably makes the reference normative 4888 because one needs that specification to know what the present 4889 document requires. It has been moved in the -03 version of this 4890 draft, but, unless it is move to Internet Standard, it will require 4891 downref treatment. 4893 G.9. Revisiting Quoted Strings 4895 Recent discussions both in and out of the IETF have highlighted 4896 instances of non-compliance with the specification of a Local-part 4897 consisting of a Quoted-string, whether any content of QcontentSMTP 4898 that actually requires special treatment consists of qtextSMTP, 4899 quoted-pairSMTP, or both. Section 4.1.2 (of RFC 5321, repeated 4900 above) ends with a few paragraphs of warnings (essentially a partial 4901 applicability statement), the first of which cautions against 4902 cleverness with either Quoted-string or case sensitivity as a threat 4903 to interoperability. 4905 The Quoted-string portion of that discussion has apparently been 4906 widely not read or ignored. Do we need to do something else? If we 4907 do an Applicability Statement, would it be useful to either reference 4908 the discussion in this document from there or to move the discussion 4909 there and reference it (normatively?) from here? 4911 There has been a separate discussion of empty quoted strings in 4912 addresses, i.e., whether the production should be 4913 required to included at least one non-whitespace character. It is 4914 separate from this issue but would be further impacted or distorted 4915 from the considerations identified in this Section. 4916 Ticket #21. May also interact with Ticket #35. 4918 G.10. Internationalization 4920 RFC 5321 came long before work on internationalization of email 4921 addresses and headers (other than by use of encoded words in MINE) 4922 and specifically before the work of the EAI WG leading to the 4923 SMTPUTF8 specifications, specifically RFCs 6530ff. The second 4924 explanatory paragraph at the end of Section 4.1.2 ("Systems MUST NOT 4925 define mailboxes ...") is an extremely strong prohibition against the 4926 use of non-ASCII characters in SMTP commands and the requirements 4927 about message content in Section 2.3.1 an equally strong one for 4928 content. Would it be appropriate to add something like "in the 4929 absence of relevant extensions" there? Also, given [mis]behavior 4930 seen in the wild, does that paragraph (or an A/S) need an explicit 4931 caution about SMTP servers or clients assuming they can apply the 4932 popular web convention of using %NN sequences as a way to encode non- 4933 ASCII characters ( in RFC 3986) and assuming some later 4934 system will interpret it as they expect? Would it be appropriate to 4935 add an Internationalization Considerations section to the body of 4936 this document if only for the purpose of pointing people elsewhere? 4938 More broadly, while the EAI WG's extensions for non-ASCII headers and 4939 addresses are explicitly out of scope for the EMAILCORE WG (at least 4940 for 5321bis (and 5322bis), those documents make assumptions and 4941 interpretations of the core documents. Are there areas in which 4942 5321bis could and should be clarified to lay a more solid foundation 4943 for the EAI/SMTPUTF8 work and, if so, what are they? 4945 G.11. SMTP Clients, Servers, Senders, and Receivers 4947 RFC 821 used the terms "SMTP-sender" and "SMTP-receiver". In RFC 4948 2821 (and hence in 5321), we switched that to "client" and "server" 4949 (See the discussion in Section 1.2). In part because a relay is a 4950 server and then a client (in some recent practice, even interleaving 4951 the two functions by opening the connection to the next host in line 4952 and sending commands before the incoming transaction is complete), 4953 RFC 5321 continues to use the original terminology in some places. 4954 Should we revisit that usage, possibly even returning to consistent 4955 use of the original terminology? 4957 G.12. Extension Keywords Starting in 'X-' 4959 Section 2.2.2 contains a discussion of SMTP keywords starting in "X". 4960 Given general experience with such things and RFC 6648, is there any 4961 reason to not deprecate that practice entirely and remove that text? 4962 If we do so, should Section 4.1.5 be dropped or rewritten to make 4963 clear this is an obsolete practice? 4964 Ticket #42. 4966 G.13. Deprecating HELO 4968 RFC 5321 (and 2821 before it) very carefully circle around the status 4969 of HELO, even recommending its use as a fallback when EHLO is sent 4970 and a "command not recognized" response is received. We are just a 4971 few months short of 20 years; is it time to deprecate the thing and 4972 clean out some or all of that text? And, given a recent (4Q2020) 4973 discussion on the EMAILCORE list, should EHLO be explicitly bound to 4974 SMTP over TCP with the older transports allowed only with HELO? 4975 While those questions may seem independent, separating them is fairly 4976 hard given the way the text is now constructed. 4978 Resolved 2021-01-19: No change 4979 Ticket #43. 4981 G.14. The FOR Clause in Trace Fields: Semantics, Security 4982 Considerations, and Other Issues 4984 The FOR clause in time-stamp ("Received:") fields is seriously under- 4985 defined. It is optional, the syntax is clear, but its semantics and 4986 use, while perhaps obvious from content and the application of common 4987 sense, have never been defined ("never" going back to 821). Do we 4988 want to better define it? Is there any chance that a definition 4989 would invalid existing, conforming and sensible, implementations? If 4990 we do want to define semantics, draft text and advice as to where it 4991 should go are invited. 4993 Note the existing discussions in Section 7.2 and Section 7.6 as they 4994 may need adjustment, or at least cross-references, especially if FOR 4995 is more precisely defined. 4997 There is probably an error in Section 7.6. Its last sentence implies 4998 a possible interaction between messages with multiple recipients and 4999 the FOR clause of trace fields. However, because the syntax of the 5000 FOR clause only allows one Mailbox (or Path), it isn't clear if that 5001 statement is meaningful. Should it be revised to discuss other 5002 situations in which including FOR might not be desirable from a 5003 security or privacy standpoint? 5005 G.15. Resistance to Attacks and Operational Necessity 5007 Section 7.8 is often cited as allowing an exception to the rules of 5008 the specification for reasons of operational necessity, not just 5009 attack resistance. I (JcK) believe the broader interpretation was 5010 intended by YAM (the section was new in RFC 5321). Recommendation: 5011 change the title to explicitly include "Local Operational 5012 Requirements" and add text to indicate that attack resistance is not 5013 the only possible source of such requirements. 5015 Appendix H. RFC 5321 Errata Summary and Tentative Change Log 5017 [[RFC Editor: Please remove this section before publication.]] 5019 H.1. RFC 5321 Errata Summary 5021 This document addresses the following errata filed against RFC 5321 5022 since its publication in October 2008 [52]. As with the previous 5023 appendix, ticket numbers included below reference 5024 https://trac.ietf.org/trac/emailcore/report/1 . [[CREF17: [[Note in 5025 Draft: Items with comments below have not yet been resolved as 5026 errata. As of the end of November 2020, none of them have been 5027 checked and verified by the emailcore WG.]]]]. 5029 1683 ABNF error. Section 4.4 5030 Ticket #23. 5032 4198 Description error. Section 4.2. 5033 RESOLVED, ticket #24, 2020-12-14. 5035 2578 Syntax description error. Section 4.1.2 5037 1543 Wrong code in description Section 3.8 5038 Ticket #26 5040 4315 ABNF - IPv6 Section 4.1.3. [[CREF18: [5321bis]The IPv6 syntax 5041 has been adjusted since 5321 was published. See the rewritten 5042 form and the comment in the section cited in the previous 5043 sentence. The editor awaits instructions. See https://www.rfc- 5044 editor.org/errata/eid4315]] 5045 Ticket #27. 5047 5414 ABNF for Quoted-string Section 4.1.2 5048 Ticket #22. 5050 1851 Location of text on unexpected close Section 4.1.1.5. Text 5051 moved per email 2020-12-31. 5052 Ticket #28. 5054 3447 Use of normative language (e.g., more "MUST"s), possible 5055 confusion in some sections Section 4.4. [[CREF19: [5321bis]As 5056 Barry notes in his verifier comments on the erratum (see 5057 https://www.rfc-editor.org/errata/eid3447), the comments and 5058 suggestions here raise a number of interesting (and difficult) 5059 issues. One of the issues is that the core of RFCs 5321 (and 5060 2821) is text carried over from Jon Postel's RFC 821, a document 5061 that was not only written in a different style than the IETF uses 5062 today but that was written at a time when no one had dreamt of RFC 5063 2119 or even the IETF itself. It appears to me that trying to 5064 patch that style might easily result in a document that is harder 5065 to read as well as being error prone. If we want to get the 5066 document entirely into contemporary style, we really should bite 5067 the bullet and do a complete rewrite. To respond to a different 5068 point in Barry's discussion, I think an explicit statement that 5069 5321/5322 and their predecessors differ in places and why would be 5070 helpful. Text, and suggestions about where to put it, are 5071 solicited. A list of differences might be a good idea too, but 5072 getting it right might be more work than there is available energy 5073 to do correctly. ]] 5075 5711 Missing leading spaces in example Appendix D.3. [[CREF20: 5076 [5321bis]Well, this is interesting because the XML is correct and 5077 the spaces are there, embedded in artwork. So either the XML2RFC 5078 processor at the time took those leading spaces out or the RFC 5079 Editor improved on the document and the change was not caught in 5080 AUTH48, perhaps because rfcdiff ignores white space. We just need 5081 to watch for future iterations. ]] 5082 As of 2021-03-15, both the txt and html-ized versions of draft- 5083 ietf-emailcore-rfc5321bis-02 were showing identical output for 5084 both parts of the example, so the problem appears to be OBE at 5085 worst. 5086 Ticket #29 (closed 2021-03-16) 5088 4055 Erratum claims the the description of SPF and DKIM is wrong. 5089 It is not clear what 5321bis should really say about them, but the 5090 current text probably needs work (or dropping, which is what the 5091 proposed erratum suggests). See 5321bis Editor's Note in 5092 Section 3.6.2. 5093 Ticket #30. 5095 [[CREF21: [5321bis]Note that rejected errata have _not_ been reviewed 5096 to see if they contain anything useful that should be discussed again 5097 with the possibility of rethinking and changing text. Volunteers 5098 sought.]] 5100 H.2. Changes from RFC 5321 (published October 2008) to the initial 5101 (-00) version of this draft 5103 o Acknowledgments section (Section 9) trimmed back for new document. 5105 o Introductory paragraph to Appendix F extended to make it clear 5106 that these features were deprecated a long time ago and really 5107 should not be in use any more. 5109 o Adjusted some language to clarify that source routes really, 5110 really, should not be used or depended upon. 5112 o IPv6 address syntax replaced by a copy of the IPv6 URI syntax and 5113 a note added. 5115 o Production index added as a first step in tying all productions to 5116 their sources. As part of the effort to make the document more 5117 easily navigable, table of contents entries have been created for 5118 the individual command descriptions. 5120 o Clarified the relationship between the SMTP "letters, digits, and 5121 hyphens" and DNS "preferred name syntax" (Section 2.3.5). 5123 o Revised the reply code sections to add new 521 and 556 codes, 5124 clarify relationships, and be explicit about the requirement for 5125 clients to rely on first digits rather than the sequences in 5126 Section 4.3.2. 5128 o In conjunction with the above, explicitly obsolete RFCs 1846 and 5129 7504. 5131 o Incorporated a correction reflecting Errata ID 2578. 5133 o Some small editorial changes made to eliminate redundant 5134 statements that were very close together. Other, equally small, 5135 editorial changes have been made to improve grammar or clarity. 5137 o A few questions, marked "[[5321bis Editor's Note:", or "[[Note in 5138 Draft" have been added for the group to resolve. Other questions, 5139 especially those in the errata summary, are simply included in 5140 narrative comments in CREFs. 5142 o Checked and rationalized "response" (to a command) and "reply 5143 code" terminology. One can talk about a "999 response" but only a 5144 "999 reply code". There is no such thing as a "response code". 5146 o Added note about length limit on mailbox names ("email 5147 addresses"). 5149 o Added an "errata summary" subsection to this change log/ 5150 comparison to 5321 in this Appendix. The entire Appendix will, of 5151 course, disappear at the time of RFC publication unless someone 5152 wants to make a strong case for retaining it. 5154 o Rationalized CREFs to 2821, 5321, 5321bis etc.; added note to 5155 readers below the Abstract. 5157 o Temporarily added a "Note on Reading This Working Draft" after the 5158 Abstract. 5160 H.3. Changes Among Versions of Rfc5321bis 5162 H.3.1. Changes from draft-klensin-rfc5321bis-00 (posted 2012-12-02) to 5163 -01 5165 Substantively, these two versions differ only by suppression of the 5166 CREF and other discussion associated with the evolution from RFC 2821 5167 to RFC 5321. That change includes an update to the document's Note 5168 to Readers, the date, the file name, and the addition of this change 5169 log subsection. 5171 H.3.2. Changes from draft-klensin-rfc5321bis-01 (20191203) to -02 5173 o Minor clarifications to improve text, e.g., addition of NOOP to 5174 the list of non-mail transaction examples in Section 4.1.4. 5176 o Added topics exposed in the ietf-smtp list and the IETF list 5177 "dogfood" discussion during December 2019 and an index listing of 5178 substantive issues identified only in CREFs in the prior draft as 5179 a new Appendix G.. 5181 H.3.3. Changes from draft-klensin-rfc5321bis-02 (2019-12-27) to -03 5183 o Added more text to Appendix G.7.1 to specifically call out the 5184 session-opening policy issues surrounding these codes. 5186 o Added discussion of "1yz" reinstatement in Appendix G.7.11. 5188 o Added discussion of timeouts in Appendix G.7.12. 5190 o Added subsection on Enhanced Status Codes and DSNs to the 5191 outstanding issues list Appendix G.8. 5193 o Replaced reference to RFC 1652 (8BITMIME) with the Internet 5194 Standard version, RFC 6152. 5196 o With help from cketti, clarified the ABNF productions whose 5197 terminals appear in other documents. 5199 o Added discussions of Quoted-string, Internationalization, and 5200 client-server versus sender-receiver terminology to Appendix G. 5202 o Added note to the Abstract. 5204 H.3.4. Changes from draft-klensin-rfc5321bis-03 (2020-07-02) to draft- 5205 ietf-emailcore-rfc5321bis-00 5207 o Added a paragraph about non-null quoted strings to Appendix G.9. 5209 o Added an explicit pointer to email insecurity and TLS to 5210 Appendix G.6. Inspired by Ben Kaduk's comment on the WG Charter, 5211 2020-09-09. 5213 o Converted document from individual to emailcore WG effort. 5215 H.3.5. Changes from draft-ietf-emailcore-rfc5321bis-00 (2020-10-06) to 5216 -01 5218 o Editorial: Corrected "blackslash" to "backslash" 5220 o Rewrote the introduction to Appendix G slightly to reflect the 5221 creation of the EMAILCORE WG. 5223 o Applied fixes for repeated use of EHLO. See Appendix G.2. 5225 o Added two new questions, one about "X" extensions (Appendix G.12) 5226 and one about the status of HELO (Appendix G.13). 5228 o Removed mention of SEND, SAML, SOML from the main body of the text 5229 (Ticket #20). 5231 o Added a warning about side effects to Appendix G.7.5. 5233 o Added ticket numbers to descriptions of issues and changes, 5234 adjusted some text so relationships would be more clear, and added 5235 subsections to the Appendix G and H lists to pick up on tickets 5236 that were not easily identified in those sections of with the 5237 text. 5239 o Made several additions to the Index, including one to deal with 5240 SEND et al., as above. 5242 H.3.6. Changes from draft-ietf-emailcore-rfc5321bis-01 (2020-12-25) to 5243 -02 5245 o Corrected discussion mailing list to point to emailcore@ietf.org 5246 in the introductory note. 5248 o Added new subsection(s) to Appendix G to reflect newly discovered 5249 issues. 5251 o Changed "as discussed in" references in Section 4.5.5 per ticket 5252 #45. 5254 o Corrected a misleading use of the term "mailbox" in Section 3.3. 5256 o Changed descriptions of use of first digit in replies per ticket 5257 #13. See Appendix G.7.7. 5259 o Moved paragraph per ticket #28, erratum 1851. 5261 o Added more clarifying cross-references, clarified some CREFs, and 5262 cleaned out some of those that no longer seemed relevant. 5264 o Removed "updates 1123" is unnecessary and obsolete. 5266 o Updated several references. 5268 H.3.7. Changes from draft-ietf-emailcore-rfc5321bis-02 (2021-02-21) to 5269 -03 5271 o Editorial: Fixed some instances of constructions like "RCPT TO 5272 command". The name of the command is RCPT. Sloppy editing in 5273 2008. 5275 o Added text and cross-references to clarify the role of 452 and 552 5276 in "too many recipients" situations. 5278 o Added Appendix G.15 to discuss changes to better reflect 5279 "operational necessity" issue. 5281 o Added detail for erratum 5711, ticket #29. 5283 o Added new subsections of Appendix G.7 to keep some previously- 5284 unnoted CREF notes from getting lost. Also removed some CREFs 5285 that were notes on changes made before the WG was created or 5286 appeared to no longer have value and trimmed or rewrote some of 5287 the remaining ones. 5289 o More discussion of Ticket #13, See Appendix G.7.7. 5291 o Identified Ticket #41 as closed. See Appendix Appendix G.7.3; 5292 notes removed from Section 2.3.5. 5294 o "SHOULD" requirement for interpreting 552 "too many recipients" 5295 removed from Section 4.5.3.1.10, explanation added, and text 5296 cleaned up. Also removed the parenthetical historical notes on 5297 the return code definitions in Section 4.2. See Appendix G.5. 5298 (Ticket #5) 5300 o Modified Appendix G.8 to add a note about the normative status of 5301 RFC 3463 and moved that reference. 5303 o Several clarifications to initiation and termination of mail 5304 transactions in Section 4.1.4. 5306 o Several additional minor editorial improvements. 5308 o Note for this particular draft only: Notes were posted to the list 5309 on 2021-07-09 about tickets #7, #10, #14, #19, #20, $30, and #42. 5310 Even though some comments about them appeared in the subsequent 5311 day or so, there appears to have been insufficient time for 5312 discussions to stabilize sufficiently for changes to be included 5313 in this version of the I-D. 5315 Index 5317 A 5318 Argument Syntax 5319 A-d-l 43 5320 Additional-Registered-Clauses 64 5321 address-literal 44 5322 Addtl-Link 64 5323 Addtl-Protocol 64 5324 ALPHA 43 5325 Argument 43 5326 At-domain 43 5327 atext 43 5328 Atom 44 5329 By-domain 63 5330 CFWS 43 5331 CRLF 43 5332 dcontent 46 5333 DIGIT 43 5334 Domain 43 5335 Dot-string 44 5336 esmtp-keyword 43 5337 esmtp-param 43 5338 esmtp-value 43 5339 Extended-Domain 63 5340 For 63 5341 Forward-Path 43 5342 From-domain 63 5343 FWS 43 5344 General-address-literal 46 5345 Greeting 49 5346 h16 46 5347 HEXDIG 43 5348 ID 63 5349 IPv4-address-literal 45 5350 IPv6-addr 46 5351 IPv6-address-literal 46 5352 Keyword 43 5353 Ldh-str 44 5354 Let-dig 44 5355 Link 64 5356 Local-part 44 5357 ls32 46 5358 Mail-parameters 43 5359 Mailbox 44 5360 Opt-info 63 5361 Path 43 5362 Protocol 64 5363 QcontentSMTP 44 5364 qtextSMTP 44 5365 quoted-pairSMTP 44 5366 Quoted-string 44 5367 Rcpt-parameters 43 5368 Reply-code 49 5369 Reply-line 49 5370 Return-path-line 63 5371 Reverse-Path 43 5372 Snum 46 5373 SP 43 5374 Stamp 63 5375 Standardized-tag 46 5376 String 44 5377 sub-domain 43 5378 TCP-info 63 5379 textstring 49 5380 Time-stamp-line 63 5381 Via 63 5382 With 63 5384 C 5385 Command Syntax 5386 data 40 5387 ehlo 20, 35 5388 expn 41 5389 helo 35 5390 help 41 5391 mail 37 5392 noop 42 5393 quit 42 5394 rcpt 39 5395 rset 40 5396 send, saml, soml 104 5397 vrfy 41 5399 Author's Address 5401 John C. Klensin 5402 1770 Massachusetts Ave, Suite 322 5403 Cambridge, MA 02140 5404 USA 5406 EMail: john-ietf@jck.com