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