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