< draft-klensin-rfc5321bis-00.txt   draft-klensin-rfc5321bis-01.txt >
Network Working Group J. Klensin Network Working Group J. Klensin
Internet-Draft December 2, 2019 Internet-Draft December 3, 2019
Obsoletes: 5321, 1846, 7504 (if Obsoletes: 5321, 1846, 7504 (if
approved) approved)
Updates: 1123 (if approved) Updates: 1123 (if approved)
Intended status: Standards Track Intended status: Standards Track
Expires: June 4, 2020 Expires: June 5, 2020
Simple Mail Transfer Protocol Simple Mail Transfer Protocol
draft-klensin-rfc5321bis-00 draft-klensin-rfc5321bis-01
Abstract Abstract
This document is a specification of the basic protocol for Internet This document is a specification of the basic protocol for Internet
electronic mail transport. It consolidates, updates, and clarifies electronic mail transport. It consolidates, updates, and clarifies
several previous documents, making all or parts of most of them several previous documents, making all or parts of most of them
obsolete. It covers the SMTP extension mechanisms and best practices obsolete. It covers the SMTP extension mechanisms and best practices
for the contemporary Internet, but does not provide details about for the contemporary Internet, but does not provide details about
particular extensions. Although SMTP was designed as a mail particular extensions. Although SMTP was designed as a mail
transport and delivery protocol, this specification also contains transport and delivery protocol, this specification also contains
information that is important to its use as a "mail submission" information that is important to its use as a "mail submission"
protocol for "split-UA" (User Agent) mail reading systems and mobile protocol for "split-UA" (User Agent) mail reading systems and mobile
environments. environments.
Note on Reading This Working Draft Note on Reading This Working Draft
This working draft contains a relatively complete trace of This working draft is extensively annotated with information about
significant changes since RFC 2821. CREF comments marked "[2821]" or changes made over the decade since RFC 5321 appeared, especially when
"[2821bis]" are pre-RFC 5321 and can be safely ignored unless there those changes might be controversial or should get careful review.
is some reason to reopen the related issues. Those notes on 2821 Anything marked in CREF comments with "[5321bis]" is current. In
will be removed (and this note modified) in the -01 draft, which will general, unless those are marked with "[[Note in Draft", in the
be posted with a 3 December date. It otherwise not expected to contents of an "Editor's note", or are in the "Errata Summary"
differ from this one -- readers should take their pick. Anything appendix (Appendix G.1, they are just notes on changes that have
marked "[5321bis]" is current. In general, unless those are marked already been made and where those changes originated. Comments
with "[[Note in Draft", in the contents of an "Editor's note", or are
in the "Errata Summary" appendix, they are just notes on changes that
have already been made and where the changes originated. Comments
identified as "2821ter" arose after the Last Call on what became identified as "2821ter" arose after the Last Call on what became
RFC5321, sometimes before AUTH48 on that document or a bit later. RFC5321, sometimes before AUTH48 on that document or a bit later.
Those, of course, should still be reviewed. Surviving comments about Those, of course, should still be reviewed. Surviving comments about
rfc5321bis-00 followed by a letter indicate intermediate working rfc5321bis-00 followed by a letter indicate intermediate working
versions of this draft and can be ignored unless the origin of versions of this draft and can be ignored unless the origin of
changes is important. As one can tell from the dates (when they are changes is important. As one can tell from the dates (when they are
given), this document has been periodically updated over a very long given), this document has been periodically updated over a very long
period of time. period of time.
Status of This Memo Status of This Memo
skipping to change at page 2, line 20 skipping to change at page 2, line 20
Internet-Drafts are working documents of the Internet Engineering Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF). Note that other groups may also distribute Task Force (IETF). Note that other groups may also distribute
working documents as Internet-Drafts. The list of current Internet- working documents as Internet-Drafts. The list of current Internet-
Drafts is at https://datatracker.ietf.org/drafts/current/. Drafts is at https://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months Internet-Drafts are draft documents valid for a maximum of six months
and may be updated, replaced, or obsoleted by other documents at any and may be updated, replaced, or obsoleted by other documents at any
time. It is inappropriate to use Internet-Drafts as reference time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress." material or to cite them other than as "work in progress."
This Internet-Draft will expire on June 4, 2020. This Internet-Draft will expire on June 5, 2020.
Copyright Notice Copyright Notice
Copyright (c) 2019 IETF Trust and the persons identified as the Copyright (c) 2019 IETF Trust and the persons identified as the
document authors. All rights reserved. document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents Provisions Relating to IETF Documents
(https://trustee.ietf.org/license-info) in effect on the date of (https://trustee.ietf.org/license-info) in effect on the date of
publication of this document. Please review these documents publication of this document. Please review these documents
skipping to change at page 2, line 45 skipping to change at page 2, line 45
described in the Simplified BSD License. described in the Simplified BSD License.
Table of Contents Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 5 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 5
1.1. Transport of Electronic Mail . . . . . . . . . . . . . . 5 1.1. Transport of Electronic Mail . . . . . . . . . . . . . . 5
1.2. History and Context for This Document . . . . . . . . . . 5 1.2. History and Context for This Document . . . . . . . . . . 5
1.3. Document Conventions . . . . . . . . . . . . . . . . . . 7 1.3. Document Conventions . . . . . . . . . . . . . . . . . . 7
2. The SMTP Model . . . . . . . . . . . . . . . . . . . . . . . 7 2. The SMTP Model . . . . . . . . . . . . . . . . . . . . . . . 7
2.1. Basic Structure . . . . . . . . . . . . . . . . . . . . . 7 2.1. Basic Structure . . . . . . . . . . . . . . . . . . . . . 7
2.2. The Extension Model . . . . . . . . . . . . . . . . . . . 10 2.2. The Extension Model . . . . . . . . . . . . . . . . . . . 9
2.2.1. Background . . . . . . . . . . . . . . . . . . . . . 10 2.2.1. Background . . . . . . . . . . . . . . . . . . . . . 9
2.2.2. Definition and Registration of Extensions . . . . . . 11 2.2.2. Definition and Registration of Extensions . . . . . . 10
2.2.3. Special Issues with Extensions . . . . . . . . . . . 12 2.2.3. Special Issues with Extensions . . . . . . . . . . . 11
2.3. SMTP Terminology . . . . . . . . . . . . . . . . . . . . 12 2.3. SMTP Terminology . . . . . . . . . . . . . . . . . . . . 12
2.3.1. Mail Objects . . . . . . . . . . . . . . . . . . . . 12 2.3.1. Mail Objects . . . . . . . . . . . . . . . . . . . . 12
2.3.2. Senders and Receivers . . . . . . . . . . . . . . . . 13 2.3.2. Senders and Receivers . . . . . . . . . . . . . . . . 12
2.3.3. Mail Agents and Message Stores . . . . . . . . . . . 13 2.3.3. Mail Agents and Message Stores . . . . . . . . . . . 13
2.3.4. Host . . . . . . . . . . . . . . . . . . . . . . . . 13 2.3.4. Host . . . . . . . . . . . . . . . . . . . . . . . . 13
2.3.5. Domain Names . . . . . . . . . . . . . . . . . . . . 14 2.3.5. Domain Names . . . . . . . . . . . . . . . . . . . . 13
2.3.6. Buffer and State Table . . . . . . . . . . . . . . . 15 2.3.6. Buffer and State Table . . . . . . . . . . . . . . . 14
2.3.7. Commands and Replies . . . . . . . . . . . . . . . . 15 2.3.7. Commands and Replies . . . . . . . . . . . . . . . . 14
2.3.8. Lines . . . . . . . . . . . . . . . . . . . . . . . . 16 2.3.8. Lines . . . . . . . . . . . . . . . . . . . . . . . . 15
2.3.9. Message Content and Mail Data . . . . . . . . . . . . 16 2.3.9. Message Content and Mail Data . . . . . . . . . . . . 15
2.3.10. Originator, Delivery, Relay, and Gateway Systems . . 16 2.3.10. Originator, Delivery, Relay, and Gateway Systems . . 15
2.3.11. Mailbox and Address . . . . . . . . . . . . . . . . . 17 2.3.11. Mailbox and Address . . . . . . . . . . . . . . . . . 16
2.4. General Syntax Principles and Transaction Model . . . . . 17 2.4. General Syntax Principles and Transaction Model . . . . . 16
3. The SMTP Procedures: An Overview . . . . . . . . . . . . . . 19 3. The SMTP Procedures: An Overview . . . . . . . . . . . . . . 18
3.1. Session Initiation . . . . . . . . . . . . . . . . . . . 19 3.1. Session Initiation . . . . . . . . . . . . . . . . . . . 18
3.2. Client Initiation . . . . . . . . . . . . . . . . . . . . 20 3.2. Client Initiation . . . . . . . . . . . . . . . . . . . . 19
3.3. Mail Transactions . . . . . . . . . . . . . . . . . . . . 20 3.3. Mail Transactions . . . . . . . . . . . . . . . . . . . . 19
3.4. Forwarding for Address Correction or Updating . . . . . . 23 3.4. Forwarding for Address Correction or Updating . . . . . . 22
3.5. Commands for Debugging Addresses . . . . . . . . . . . . 24 3.5. Commands for Debugging Addresses . . . . . . . . . . . . 23
3.5.1. Overview . . . . . . . . . . . . . . . . . . . . . . 24 3.5.1. Overview . . . . . . . . . . . . . . . . . . . . . . 23
3.5.2. VRFY Normal Response . . . . . . . . . . . . . . . . 26 3.5.2. VRFY Normal Response . . . . . . . . . . . . . . . . 25
3.5.3. Meaning of VRFY or EXPN Success Response . . . . . . 27 3.5.3. Meaning of VRFY or EXPN Success Response . . . . . . 26
3.5.4. Semantics and Applications of EXPN . . . . . . . . . 28 3.5.4. Semantics and Applications of EXPN . . . . . . . . . 26
3.6. Relaying and Mail Routing . . . . . . . . . . . . . . . . 28 3.6. Relaying and Mail Routing . . . . . . . . . . . . . . . . 26
3.6.1. Source Routes and Relaying . . . . . . . . . . . . . 28 3.6.1. Source Routes and Relaying . . . . . . . . . . . . . 26
3.6.2. Mail eXchange Records and Relaying . . . . . . . . . 28 3.6.2. Mail eXchange Records and Relaying . . . . . . . . . 27
3.6.3. Message Submission Servers as Relays . . . . . . . . 29 3.6.3. Message Submission Servers as Relays . . . . . . . . 28
3.7. Mail Gatewaying . . . . . . . . . . . . . . . . . . . . . 30 3.7. Mail Gatewaying . . . . . . . . . . . . . . . . . . . . . 29
3.7.1. Header Fields in Gatewaying . . . . . . . . . . . . . 30 3.7.1. Header Fields in Gatewaying . . . . . . . . . . . . . 29
3.7.2. Received Lines in Gatewaying . . . . . . . . . . . . 31 3.7.2. Received Lines in Gatewaying . . . . . . . . . . . . 29
3.7.3. Addresses in Gatewaying . . . . . . . . . . . . . . . 31 3.7.3. Addresses in Gatewaying . . . . . . . . . . . . . . . 30
3.7.4. Other Header Fields in Gatewaying . . . . . . . . . . 31 3.7.4. Other Header Fields in Gatewaying . . . . . . . . . . 30
3.7.5. Envelopes in Gatewaying . . . . . . . . . . . . . . . 32 3.7.5. Envelopes in Gatewaying . . . . . . . . . . . . . . . 30
3.8. Terminating Sessions and Connections . . . . . . . . . . 32 3.8. Terminating Sessions and Connections . . . . . . . . . . 30
3.9. Mailing Lists and Aliases . . . . . . . . . . . . . . . . 33 3.9. Mailing Lists and Aliases . . . . . . . . . . . . . . . . 31
3.9.1. Alias . . . . . . . . . . . . . . . . . . . . . . . . 33 3.9.1. Alias . . . . . . . . . . . . . . . . . . . . . . . . 32
3.9.2. List . . . . . . . . . . . . . . . . . . . . . . . . 34 3.9.2. List . . . . . . . . . . . . . . . . . . . . . . . . 32
4. The SMTP Specifications . . . . . . . . . . . . . . . . . . . 34 4. The SMTP Specifications . . . . . . . . . . . . . . . . . . . 32
4.1. SMTP Commands . . . . . . . . . . . . . . . . . . . . . . 34 4.1. SMTP Commands . . . . . . . . . . . . . . . . . . . . . . 32
4.1.1. Command Semantics and Syntax . . . . . . . . . . . . 34 4.1.1. Command Semantics and Syntax . . . . . . . . . . . . 32
4.1.2. Command Argument Syntax . . . . . . . . . . . . . . . 44 4.1.2. Command Argument Syntax . . . . . . . . . . . . . . . 41
4.1.3. Address Literals . . . . . . . . . . . . . . . . . . 46 4.1.3. Address Literals . . . . . . . . . . . . . . . . . . 43
4.1.4. Order of Commands . . . . . . . . . . . . . . . . . . 48 4.1.4. Order of Commands . . . . . . . . . . . . . . . . . . 45
4.1.5. Private-Use Commands . . . . . . . . . . . . . . . . 50 4.1.5. Private-Use Commands . . . . . . . . . . . . . . . . 46
4.2. SMTP Replies . . . . . . . . . . . . . . . . . . . . . . 50 4.2. SMTP Replies . . . . . . . . . . . . . . . . . . . . . . 47
4.2.1. Reply Code Severities and Theory . . . . . . . . . . 52 4.2.1. Reply Code Severities and Theory . . . . . . . . . . 48
4.2.2. Reply Codes by Function Groups . . . . . . . . . . . 55 4.2.2. Reply Codes by Function Groups . . . . . . . . . . . 51
4.2.3. Reply Codes in Numeric Order . . . . . . . . . . . . 56 4.2.3. Reply Codes in Numeric Order . . . . . . . . . . . . 52
4.2.4. Some specific code situations and relationships . . . 58 4.2.4. Some specific code situations and relationships . . . 54
4.3. Sequencing of Commands and Replies . . . . . . . . . . . 59 4.3. Sequencing of Commands and Replies . . . . . . . . . . . 55
4.3.1. Sequencing Overview . . . . . . . . . . . . . . . . . 59 4.3.1. Sequencing Overview . . . . . . . . . . . . . . . . . 55
4.3.2. Command-Reply Sequences . . . . . . . . . . . . . . . 60 4.3.2. Command-Reply Sequences . . . . . . . . . . . . . . . 56
4.4. Trace Information . . . . . . . . . . . . . . . . . . . . 63 4.4. Trace Information . . . . . . . . . . . . . . . . . . . . 58
4.5. Additional Implementation Issues . . . . . . . . . . . . 67 4.5. Additional Implementation Issues . . . . . . . . . . . . 62
4.5.1. Minimum Implementation . . . . . . . . . . . . . . . 67 4.5.1. Minimum Implementation . . . . . . . . . . . . . . . 62
4.5.2. Transparency . . . . . . . . . . . . . . . . . . . . 68 4.5.2. Transparency . . . . . . . . . . . . . . . . . . . . 63
4.5.3. Sizes and Timeouts . . . . . . . . . . . . . . . . . 69 4.5.3. Sizes and Timeouts . . . . . . . . . . . . . . . . . 64
4.5.4. Retry Strategies . . . . . . . . . . . . . . . . . . 73 4.5.4. Retry Strategies . . . . . . . . . . . . . . . . . . 68
4.5.5. Messages with a Null Reverse-Path . . . . . . . . . . 75 4.5.5. Messages with a Null Reverse-Path . . . . . . . . . . 70
5. Address Resolution and Mail Handling . . . . . . . . . . . . 76 5. Address Resolution and Mail Handling . . . . . . . . . . . . 70
5.1. Locating the Target Host . . . . . . . . . . . . . . . . 76 5.1. Locating the Target Host . . . . . . . . . . . . . . . . 71
5.2. IPv6 and MX Records . . . . . . . . . . . . . . . . . . . 78 5.2. IPv6 and MX Records . . . . . . . . . . . . . . . . . . . 73
6. Problem Detection and Handling . . . . . . . . . . . . . . . 79 6. Problem Detection and Handling . . . . . . . . . . . . . . . 73
6.1. Reliable Delivery and Replies by Email . . . . . . . . . 79 6.1. Reliable Delivery and Replies by Email . . . . . . . . . 73
6.2. Unwanted, Unsolicited, and "Attack" Messages . . . . . . 80 6.2. Unwanted, Unsolicited, and "Attack" Messages . . . . . . 74
6.3. Loop Detection . . . . . . . . . . . . . . . . . . . . . 81 6.3. Loop Detection . . . . . . . . . . . . . . . . . . . . . 75
6.4. Compensating for Irregularities . . . . . . . . . . . . . 81 6.4. Compensating for Irregularities . . . . . . . . . . . . . 75
7. Security Considerations . . . . . . . . . . . . . . . . . . . 82 7. Security Considerations . . . . . . . . . . . . . . . . . . . 77
7.1. Mail Security and Spoofing . . . . . . . . . . . . . . . 82 7.1. Mail Security and Spoofing . . . . . . . . . . . . . . . 77
7.2. "Blind" Copies . . . . . . . . . . . . . . . . . . . . . 83 7.2. "Blind" Copies . . . . . . . . . . . . . . . . . . . . . 78
7.3. VRFY, EXPN, and Security . . . . . . . . . . . . . . . . 84 7.3. VRFY, EXPN, and Security . . . . . . . . . . . . . . . . 78
7.4. Mail Rerouting Based on the 251 and 551 Response 7.4. Mail Rerouting Based on the 251 and 551 Response
Codes . . . . . . . . . . . . . . . . . . . . . . . . . . 85 Codes . . . . . . . . . . . . . . . . . . . . . . . . . . 79
7.5. Information Disclosure in Announcements . . . . . . . . . 85 7.5. Information Disclosure in Announcements . . . . . . . . . 79
7.6. Information Disclosure in Trace Fields . . . . . . . . . 85 7.6. Information Disclosure in Trace Fields . . . . . . . . . 80
7.7. Information Disclosure in Message Forwarding . . . . . . 86 7.7. Information Disclosure in Message Forwarding . . . . . . 80
7.8. Resistance to Attacks . . . . . . . . . . . . . . . . . . 86 7.8. Resistance to Attacks . . . . . . . . . . . . . . . . . . 80
7.9. Scope of Operation of SMTP Servers . . . . . . . . . . . 86 7.9. Scope of Operation of SMTP Servers . . . . . . . . . . . 80
8. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 87 8. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 81
9. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 88 9. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 82
10. References . . . . . . . . . . . . . . . . . . . . . . . . . 88 10. References . . . . . . . . . . . . . . . . . . . . . . . . . 82
10.1. Normative References . . . . . . . . . . . . . . . . . . 88 10.1. Normative References . . . . . . . . . . . . . . . . . . 82
10.2. Informative References . . . . . . . . . . . . . . . . . 89 10.2. Informative References . . . . . . . . . . . . . . . . . 84
Appendix A. TCP Transport Service . . . . . . . . . . . . . . . 94 Appendix A. TCP Transport Service . . . . . . . . . . . . . . . 88
Appendix B. Generating SMTP Commands from RFC 822 Header Fields 94 Appendix B. Generating SMTP Commands from RFC 822 Header Fields 88
Appendix C. Source Routes . . . . . . . . . . . . . . . . . . . 95 Appendix C. Source Routes . . . . . . . . . . . . . . . . . . . 89
Appendix D. Scenarios . . . . . . . . . . . . . . . . . . . . . 96 Appendix D. Scenarios . . . . . . . . . . . . . . . . . . . . . 90
D.1. A Typical SMTP Transaction Scenario . . . . . . . . . . . 97 D.1. A Typical SMTP Transaction Scenario . . . . . . . . . . . 90
D.2. Aborted SMTP Transaction Scenario . . . . . . . . . . . . 97 D.2. Aborted SMTP Transaction Scenario . . . . . . . . . . . . 91
D.3. Relayed Mail Scenario . . . . . . . . . . . . . . . . . . 98 D.3. Relayed Mail Scenario . . . . . . . . . . . . . . . . . . 92
D.4. Verifying and Sending Scenario . . . . . . . . . . . . . 99 D.4. Verifying and Sending Scenario . . . . . . . . . . . . . 93
Appendix E. Other Gateway Issues . . . . . . . . . . . . . . . . 100 Appendix E. Other Gateway Issues . . . . . . . . . . . . . . . . 94
Appendix F. Deprecated Features of RFC 821 . . . . . . . . . . . 100 Appendix F. Deprecated Features of RFC 821 . . . . . . . . . . . 94
F.1. TURN . . . . . . . . . . . . . . . . . . . . . . . . . . 100 F.1. TURN . . . . . . . . . . . . . . . . . . . . . . . . . . 94
F.2. Source Routing . . . . . . . . . . . . . . . . . . . . . 101 F.2. Source Routing . . . . . . . . . . . . . . . . . . . . . 94
F.3. HELO . . . . . . . . . . . . . . . . . . . . . . . . . . 101 F.3. HELO . . . . . . . . . . . . . . . . . . . . . . . . . . 95
F.4. #-literals . . . . . . . . . . . . . . . . . . . . . . . 101 F.4. #-literals . . . . . . . . . . . . . . . . . . . . . . . 95
F.5. Dates and Years . . . . . . . . . . . . . . . . . . . . . 102 F.5. Dates and Years . . . . . . . . . . . . . . . . . . . . . 95
F.6. Sending versus Mailing . . . . . . . . . . . . . . . . . 102 F.6. Sending versus Mailing . . . . . . . . . . . . . . . . . 95
Appendix G. Change log for RFC 5321bis . . . . . . . . . . . . . 102 Appendix G. Change log for RFC 5321bis . . . . . . . . . . . . . 96
G.1. RFC 5321 Errata Summary . . . . . . . . . . . . . . . . . 102 G.1. RFC 5321 Errata Summary . . . . . . . . . . . . . . . . . 96
G.2. Changes from RFC 5321 (published October 2008) to the G.2. Changes from RFC 5321 (published October 2008) to the
initial (-00) version of this draft . . . . . . . . . . . 103 initial (-00) version of this draft . . . . . . . . . . . 97
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 G.3. Changes Among Versions of Rfc5321Bis . . . . . . . . . . 98
Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 106 G.3.1. Changes from draft-klensin-rfc5321bis-00 (posted
2012-12-02) to -01 . . . . . . . . . . . . . . . . . 98
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 100
1. Introduction 1. Introduction
1.1. Transport of Electronic Mail 1.1. Transport of Electronic Mail
The objective of the Simple Mail Transfer Protocol (SMTP) is to The objective of the Simple Mail Transfer Protocol (SMTP) is to
transfer mail reliably and efficiently. transfer mail reliably and efficiently.
SMTP is independent of the particular transmission subsystem and SMTP is independent of the particular transmission subsystem and
requires only a reliable ordered data stream channel. While this requires only a reliable ordered data stream channel. While this
skipping to change at page 5, line 41 skipping to change at page 5, line 44
In this way, a mail message may pass through a number of intermediate In this way, a mail message may pass through a number of intermediate
relay or gateway hosts on its path from sender to ultimate recipient. relay or gateway hosts on its path from sender to ultimate recipient.
The Mail eXchanger mechanisms of the domain name system (RFC 1035 The Mail eXchanger mechanisms of the domain name system (RFC 1035
[7], RFC 974 [19], and Section 5 of this document) are used to [7], RFC 974 [19], and Section 5 of this document) are used to
identify the appropriate next-hop destination for a message being identify the appropriate next-hop destination for a message being
transported. transported.
1.2. History and Context for This Document 1.2. History and Context for This Document
This document is a [[CREF1: [2821] "self-contained" removed, JcK This document is a specification of the basic protocol for the
20080225 -- it can't be with a reference list that long.]] Internet electronic mail transport. It consolidates, updates and
specification of the basic protocol for the Internet electronic mail clarifies, but does not add new or change existing functionality of
transport. It consolidates, updates and clarifies, but does not add the following:
new or change existing functionality of the following:
o the original SMTP (Simple Mail Transfer Protocol) specification of o the original SMTP (Simple Mail Transfer Protocol) specification of
RFC 821 [8], RFC 821 [8],
o domain name system requirements and implications for mail o domain name system requirements and implications for mail
transport from RFC 1035 [7] and RFC 974 [19], transport from RFC 1035 [7] and RFC 974 [19],
o the clarifications and applicability statements in RFC 1123 [3], o the clarifications and applicability statements in RFC 1123 [3],
o the new error codes added by RFC 1846 [24] and later by RFC 7504> o the new error codes added by RFC 1846 [24] and later by RFC 7504>
[48], obsoleting both of those documents, and [48], obsoleting both of those documents, and
o material drawn from the SMTP Extension mechanisms in RFC 1869 o material drawn from the SMTP Extension mechanisms in RFC 1869
[26]. [26].
o Editorial and clarification changes to RFC 2821 [34] to bring that o Editorial and clarification changes to RFC 2821 [34] to bring that
specification to Draft Standard. [[CREF2: [2821]Editorial, JcK specification to Draft Standard.
20070422.]]
It obsoletes RFC 821, RFC 974, RFC 1869, and RFC 2821 [[CREF3: It obsoletes RFC 821, RFC 974, RFC 1869, and RFC 2821 and updates RFC
[2821]Tony 20080214 #14]] and updates RFC 1123 (replacing the mail 1123 (replacing the mail transport materials of RFC 1123). However,
transport materials of RFC 1123). However, RFC 821 specifies some RFC 821 specifies some features that were not in significant use in
features that were not in significant use in the Internet by the mid- the Internet by the mid-1990s and (in appendices) some additional
1990s and (in appendices) some additional transport models. Those transport models. Those sections are omitted here in the interest of
sections are omitted here in the interest of clarity and brevity; clarity and brevity; readers needing them should refer to RFC 821.
readers needing them should refer to RFC 821.
It also includes some additional material from RFC 1123 that required It also includes some additional material from RFC 1123 that required
amplification. This material has been identified in multiple ways, amplification. This material has been identified in multiple ways,
mostly by tracking flaming on various lists and newsgroups and mostly by tracking flaming on various lists and newsgroups and
problems of unusual readings or interpretations that have appeared as problems of unusual readings or interpretations that have appeared as
the SMTP extensions have been deployed. Where this specification the SMTP extensions have been deployed. Where this specification
moves beyond consolidation and actually differs from earlier moves beyond consolidation and actually differs from earlier
documents, it supersedes them technically as well as textually. documents, it supersedes them technically as well as textually.
Although SMTP was designed as a mail transport and delivery protocol, Although SMTP was designed as a mail transport and delivery protocol,
this specification also contains information that is important to its this specification also contains information that is important to its
use as a "mail submission" protocol, as recommended for Post Office use as a "mail submission" protocol, as recommended for Post Office
Protocol (POP) (RFC 937 [17], RFC 1939 [27]) and IMAP (RFC 3501 Protocol (POP) (RFC 937 [17], RFC 1939 [27]) and IMAP (RFC 3501
[39]). [[CREF4: [2821] Changed 2060 to 3501]] In general, the [39]). In general, the separate mail submission protocol specified
separate mail submission protocol specified in RFC 4409 [43] [[CREF5: in RFC 4409 [43] is now preferred to direct use of SMTP; more
[2821]Replaced 2476 reference with 4409, changed recommendation JcK discussion of that subject appears in that document.
20080225]] is now preferred to direct use of SMTP; more discussion of
that subject appears in that document.
Section 2.3 provides definitions of terms specific to this document. Section 2.3 provides definitions of terms specific to this document.
Except when the historical terminology is necessary for clarity, this Except when the historical terminology is necessary for clarity, this
document uses the current 'client' and 'server' terminology to document uses the current 'client' and 'server' terminology to
identify the sending and receiving SMTP processes, respectively. identify the sending and receiving SMTP processes, respectively.
A companion document, RFC 5322 [11], discusses message header A companion document, RFC 5322 [11], discusses message header
sections [[CREF6: [2821]Issue 27, 20070423]] and bodies and specifies sections and bodies and specifies formats and structures for them.
formats and structures for them.
1.3. Document Conventions 1.3. Document Conventions
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
document are to be interpreted as described in RFC 2119 [1]. As each document are to be interpreted as described in RFC 2119 [1]. As each
of these terms was intentionally and carefully chosen to improve the of these terms was intentionally and carefully chosen to improve the
interoperability of email, each use of these terms is to be treated interoperability of email, each use of these terms is to be treated
as a conformance requirement. [[CREF7: [2821] Tony 20080212 #1, as a conformance requirement.
20080213 00:43]]
Because this document has a long history and to avoid the risk of Because this document has a long history and to avoid the risk of
various errors and of confusing readers and documents that point to various errors and of confusing readers and documents that point to
this one, most examples and the domain names they contain are this one, most examples and the domain names they contain are
preserved from RFC 2821. Readers are cautioned that these are preserved from RFC 2821. Readers are cautioned that these are
illustrative examples that should not actually be used in either code illustrative examples that should not actually be used in either code
or configuration files. or configuration files.
[[CREF8: [2821]This subsection and the associated rearrangement of
the 2119 text are a result of the proposed compromise with the IESG
to avoid either changing the examples or introducing an IETF Note.
JcK 20080717 - 20080721]]
2. The SMTP Model 2. The SMTP Model
[[CREF9: [5321bis] [[Editor's Note: There have been extensive and [[CREF1: [5321bis] [[Editor's Note: There have been extensive and
repeated discussions on the SMTP and IETF lists about whether this repeated discussions on the SMTP and IETF lists about whether this
document should say something about hop-by-hop (MTA-to-MTA) SMTP document should say something about hop-by-hop (MTA-to-MTA) SMTP
authentication and, if so, what?? Note that end to end message authentication and, if so, what?? Note that end to end message
authentication is almost certainly out of scope for SMTP.]]]] authentication is almost certainly out of scope for SMTP.]]]]
2.1. Basic Structure 2.1. Basic Structure
The SMTP design can be pictured as: The SMTP design can be pictured as:
+----------+ +----------+ +----------+ +----------+
skipping to change at page 8, line 20 skipping to change at page 8, line 14
identify the final destination(s) of the mail message. In other identify the final destination(s) of the mail message. In other
cases, common with SMTP clients associated with implementations of cases, common with SMTP clients associated with implementations of
the POP (RFC 937 [17], RFC 1939 [27]) or IMAP (RFC 3501 [39]) the POP (RFC 937 [17], RFC 1939 [27]) or IMAP (RFC 3501 [39])
protocols, or when the SMTP client is inside an isolated transport protocols, or when the SMTP client is inside an isolated transport
service environment, the domain determined will identify an service environment, the domain determined will identify an
intermediate destination through which all mail messages are to be intermediate destination through which all mail messages are to be
relayed. SMTP clients that transfer all traffic regardless of the relayed. SMTP clients that transfer all traffic regardless of the
target domains associated with the individual messages, or that do target domains associated with the individual messages, or that do
not maintain queues for retrying message transmissions that initially not maintain queues for retrying message transmissions that initially
cannot be completed, may otherwise conform to this specification but cannot be completed, may otherwise conform to this specification but
are not considered fully-capable. [[CREF10: [2821] Changes from are not considered fully-capable. Fully-capable SMTP
"domain name" to "domain" or equivalent per Mark E Mallett note implementations, including the relays used by these less capable
20070418, 20070422]] Fully-capable SMTP implementations, including ones, and their destinations, are expected to support all of the
the relays used by these less capable ones, and their destinations, queuing, retrying, and alternate address functions discussed in this
are expected to support all of the queuing, retrying, and alternate specification. In many situations and configurations, the less-
address functions discussed in this specification. In many capable clients discussed above SHOULD be using the message
situations and configurations, the less-capable clients discussed submission protocol (RFC 4409 [43]) rather than SMTP.
above SHOULD be using the message submission protocol (RFC 4409 [43])
rather than SMTP. [[CREF11: [2821] Klensin 20070422]]
The means by which an SMTP client, once it has determined a target The means by which an SMTP client, once it has determined a target
domain, determines the identity of an SMTP server to which a copy of domain, determines the identity of an SMTP server to which a copy of
a message is to be transferred, and then performs that transfer, are a message is to be transferred, and then performs that transfer, are
covered by this document. To effect a mail transfer to an SMTP covered by this document. To effect a mail transfer to an SMTP
server, an SMTP client establishes a two-way transmission channel to server, an SMTP client establishes a two-way transmission channel to
that SMTP server. An SMTP client determines the address of an that SMTP server. An SMTP client determines the address of an
appropriate host running an SMTP server by resolving a destination appropriate host running an SMTP server by resolving a destination
domain name to either an intermediate Mail eXchanger host or a final domain name to either an intermediate Mail eXchanger host or a final
target host. target host.
skipping to change at page 9, line 4 skipping to change at page 8, line 45
transport the message further using some protocol other than SMTP). transport the message further using some protocol other than SMTP).
SMTP commands are generated by the SMTP client and sent to the SMTP SMTP commands are generated by the SMTP client and sent to the SMTP
server. SMTP replies are sent from the SMTP server to the SMTP server. SMTP replies are sent from the SMTP server to the SMTP
client in response to the commands. client in response to the commands.
In other words, message transfer can occur in a single connection In other words, message transfer can occur in a single connection
between the original SMTP-sender and the final SMTP-recipient, or can between the original SMTP-sender and the final SMTP-recipient, or can
occur in a series of hops through intermediary systems. In either occur in a series of hops through intermediary systems. In either
case, once the server has issued a success response at the end of the case, once the server has issued a success response at the end of the
mail data, a formal handoff of responsibility for the message occurs: mail data, a formal handoff of responsibility for the message occurs:
the protocol requires that a server MUST accept responsibility for the protocol requires that a server MUST accept responsibility for
either delivering the message or properly reporting the failure to do either delivering the message or properly reporting the failure to do
so (see Sections 6.1, 6.2, and 7.8, below). [[CREF12: so (see Sections 6.1, 6.2, and 7.8, below).
[2821]Preferred->Should, etc. Issue 16 20070421. Handoff issues and
NDNs, Issue 32b per Tony Hansen 20070503]]
Once the transmission channel is established and initial handshaking Once the transmission channel is established and initial handshaking
is completed, the SMTP client normally initiates a mail transaction. is completed, the SMTP client normally initiates a mail transaction.
Such a transaction consists of a series of commands to specify the Such a transaction consists of a series of commands to specify the
originator and destination of the mail and transmission of the originator and destination of the mail and transmission of the
message content (including any lines in the header section [[CREF13: message content (including any lines in the header section or other
[2821]Issue 27 20070423]] or other structure) itself. When the same structure) itself. When the same message is sent to multiple
message is sent to multiple recipients, this protocol encourages the recipients, this protocol encourages the transmission of only one
transmission of only one copy of the data for all recipients at the copy of the data for all recipients at the same destination (or
same destination (or intermediate relay) host. intermediate relay) host.
The server responds to each command with a reply; replies may The server responds to each command with a reply; replies may
indicate that the command was accepted, that additional commands are indicate that the command was accepted, that additional commands are
expected, or that a temporary or permanent error condition exists. expected, or that a temporary or permanent error condition exists.
Commands specifying the sender or recipients may include server- Commands specifying the sender or recipients may include server-
permitted SMTP service extension requests, as discussed in permitted SMTP service extension requests, as discussed in
Section 2.2. The dialog is purposely lock-step, one-at-a-time, Section 2.2. The dialog is purposely lock-step, one-at-a-time,
although this can be modified by mutually agreed upon extension although this can be modified by mutually agreed upon extension
requests such as command pipelining (RFC 2920 [35]). requests such as command pipelining (RFC 2920 [35]).
skipping to change at page 9, line 45 skipping to change at page 9, line 35
As suggested above, this protocol provides mechanisms for the As suggested above, this protocol provides mechanisms for the
transmission of mail. Historically, this transmission normally transmission of mail. Historically, this transmission normally
occurred directly from the sending user's host to the receiving occurred directly from the sending user's host to the receiving
user's host when the two hosts are connected to the same transport user's host when the two hosts are connected to the same transport
service. When they are not connected to the same transport service, service. When they are not connected to the same transport service,
transmission occurs via one or more relay SMTP servers. A very transmission occurs via one or more relay SMTP servers. A very
common case in the Internet today involves submission of the original common case in the Internet today involves submission of the original
message to an intermediate, "message submission" server, which is message to an intermediate, "message submission" server, which is
similar to a relay but has some additional properties; such servers similar to a relay but has some additional properties; such servers
are discussed in Section 2.3.10 and at some length in RFC 4409 [43] are discussed in Section 2.3.10 and at some length in RFC 4409 [43].
[[CREF14: [2821] 6/19/2005: Per note from Vint Cerf, 20040417]]. An An intermediate host that acts as either an SMTP relay or as a
intermediate host that acts as either an SMTP relay or as a gateway gateway into some other transmission environment is usually selected
into some other transmission environment is usually selected through through the use of the domain name service (DNS) Mail eXchanger
the use of the domain name service (DNS) Mail eXchanger mechanism. mechanism. Explicit "source" routing (see Section 5 and Appendix C
Explicit "source" routing (see Section 5 and Appendix C and and Appendix F.2) SHOULD NOT be used. [[CREF2: [5321bis] JcK
Appendix F.2) SHOULD NOT be used. [[CREF15: [5321bis] JcK 20090123 - 20090123 - redundant sentence removed.]]
redundant sentence removed.]]
2.2. The Extension Model 2.2. The Extension Model
2.2.1. Background 2.2.1. Background
In an effort that started in 1990, approximately a decade after RFC In an effort that started in 1990, approximately a decade after RFC
821 was completed, the protocol was modified with a "service 821 was completed, the protocol was modified with a "service
extensions" model that permits the client and server to agree to extensions" model that permits the client and server to agree to
utilize shared functionality beyond the original SMTP requirements. utilize shared functionality beyond the original SMTP requirements.
The SMTP extension mechanism defines a means whereby an extended SMTP The SMTP extension mechanism defines a means whereby an extended SMTP
skipping to change at page 12, line 7 skipping to change at page 11, line 38
conforming server MUST NOT offer non-"X"-prefixed keyword values that conforming server MUST NOT offer non-"X"-prefixed keyword values that
are not described in a registered extension. are not described in a registered extension.
Additional verbs and parameter names are bound by the same rules as Additional verbs and parameter names are bound by the same rules as
EHLO keywords; specifically, verbs beginning with "X" are local EHLO keywords; specifically, verbs beginning with "X" are local
extensions that may not be registered or standardized. Conversely, extensions that may not be registered or standardized. Conversely,
verbs not beginning with "X" must always be registered. verbs not beginning with "X" must always be registered.
2.2.3. Special Issues with Extensions 2.2.3. Special Issues with Extensions
[[CREF16: [2821]Material in this subsection motivated by
correspondence with Randy Gellens around 20070128. Email i18n issues
were the specific motivation, but the issues are more general. It is
not clear whether this should be placed here or on some other
section.]]
Extensions that change fairly basic properties of SMTP operation are Extensions that change fairly basic properties of SMTP operation are
permitted. [[CREF17: [2821]Wording change per SM note 20071017]] The permitted. The text in other sections of this document must be
text in other sections of this document must be understood in that understood in that context. In particular, extensions can change the
context. In particular, extensions can change the minimum limits minimum limits specified in Section 4.5.3, can change the ASCII
specified in Section 4.5.3, can change the ASCII character set character set requirement as mentioned above, or can introduce some
requirement as mentioned above, or can introduce some optional modes optional modes of message handling.
of message handling.
In particular, if an extension implies that the delivery path In particular, if an extension implies that the delivery path
normally supports special features of that extension, and an normally supports special features of that extension, and an
intermediate SMTP system finds a next hop that does not support the intermediate SMTP system finds a next hop that does not support the
required extension, it MAY choose, based on the specific extension required extension, it MAY choose, based on the specific extension
and circumstances, to requeue the message and try later and/or try an and circumstances, to requeue the message and try later and/or try an
alternate MX host. If this strategy is employed, the timeout to fall alternate MX host. If this strategy is employed, the timeout to fall
back to an unextended format (if one is available) SHOULD be less back to an unextended format (if one is available) SHOULD be less
than the normal timeout for bouncing as undeliverable (e.g., if than the normal timeout for bouncing as undeliverable (e.g., if
normal timeout is three days, the requeue timeout before attempting normal timeout is three days, the requeue timeout before attempting
skipping to change at page 12, line 47 skipping to change at page 12, line 24
The SMTP envelope is sent as a series of SMTP protocol units The SMTP envelope is sent as a series of SMTP protocol units
(described in Section 3). It consists of an originator address (to (described in Section 3). It consists of an originator address (to
which error reports should be directed), one or more recipient which error reports should be directed), one or more recipient
addresses, and optional protocol extension material. Historically, addresses, and optional protocol extension material. Historically,
variations on the reverse-path (originator) address specification variations on the reverse-path (originator) address specification
command (MAIL) could be used to specify alternate delivery modes, command (MAIL) could be used to specify alternate delivery modes,
such as immediate display; those variations have now been deprecated such as immediate display; those variations have now been deprecated
(see Appendix F and Appendix F.6). (see Appendix F and Appendix F.6).
[[CREF18: [2821]??? See note from Mark E. Mallett 20070418 on the The SMTP content is sent in the SMTP DATA protocol unit and has two
use of "header" in the next paragraph.???]] The SMTP content is sent parts: the header section and the body. If the content conforms to
in the SMTP DATA protocol unit and has two parts: the header section other contemporary standards, the header section consists of a
[[CREF19: [2821]Issue 27 20070423]] and the body. If the content collection of header fields, each consisting of a header name, a
conforms to other contemporary standards, the header section consists colon, and data, structured as in the message format specification
of a collection of header fields, each consisting of a header name, a (RFC 5322 [11]); the body, if structured, is defined according to
colon, and data, [[CREF20: [2821]Issue 27 20070423]] structured as in MIME (RFC 2045 [29]). The content is textual in nature, expressed
the message format specification (RFC 5322 [11]); the body, if using the US-ASCII repertoire [2]. Although SMTP extensions (such as
structured, is defined according to MIME (RFC 2045 [29]). The "8BITMIME", RFC 1652 [23]) may relax this restriction for the content
content is textual in nature, expressed using the US-ASCII repertoire body, the content header fields are always encoded using the US-ASCII
[2]. Although SMTP extensions (such as "8BITMIME", RFC 1652 [23]) repertoire. Two MIME extensions (RFC 2047 [30] and RFC 2231 [33])
may relax this restriction for the content body, the content header define an algorithm for representing header values outside the US-
fields [[CREF21: [2821]Issue 27 20070423]] are always encoded using ASCII repertoire, while still encoding them using the US-ASCII
the US-ASCII repertoire. Two MIME extensions (RFC 2047 [30] and RFC repertoire.
2231 [33]) define an algorithm for representing header values outside
the US-ASCII repertoire, while still encoding them using the US-ASCII
repertoire. [[CREF22: [2821]Ref to 2231 added per note from Frank
Ellerman, 20070426]]
2.3.2. Senders and Receivers 2.3.2. Senders and Receivers
In RFC 821, the two hosts participating in an SMTP transaction were In RFC 821, the two hosts participating in an SMTP transaction were
described as the "SMTP-sender" and "SMTP-receiver". This document described as the "SMTP-sender" and "SMTP-receiver". This document
has been changed to reflect current industry terminology and hence has been changed to reflect current industry terminology and hence
refers to them as the "SMTP client" (or sometimes just "the client") refers to them as the "SMTP client" (or sometimes just "the client")
and "SMTP server" (or just "the server"), respectively. Since a and "SMTP server" (or just "the server"), respectively. Since a
given host may act both as server and client in a relay situation, given host may act both as server and client in a relay situation,
"receiver" and "sender" terminology is still used where needed for "receiver" and "sender" terminology is still used where needed for
skipping to change at page 14, line 4 skipping to change at page 13, line 29
often do not accurately match common, and conforming, practices with often do not accurately match common, and conforming, practices with
Internet mail. Hence, the reader should be cautious about inferring Internet mail. Hence, the reader should be cautious about inferring
the strong relationships and responsibilities that might be implied the strong relationships and responsibilities that might be implied
if these terms were used elsewhere. if these terms were used elsewhere.
2.3.4. Host 2.3.4. Host
For the purposes of this specification, a host is a computer system For the purposes of this specification, a host is a computer system
attached to the Internet (or, in some cases, to a private TCP/IP attached to the Internet (or, in some cases, to a private TCP/IP
network) and supporting the SMTP protocol. Hosts are known by names network) and supporting the SMTP protocol. Hosts are known by names
(see the next section); they SHOULD NOT be [[CREF23: [2821] 6/19/2005 (see the next section); they SHOULD NOT be identified by numerical
Editorial change - in line with IETF norms to get rid of IP address addresses, i.e., by address literals as described in Section 4.1.2.
references in applications.]] identified by numerical addresses,
i.e., by address literals as described in Section 4.1.2. [[CREF24:
[2821] additional clarification per Frank Ellerman, 20050901 ]]
2.3.5. Domain Names 2.3.5. Domain Names
[[CREF25: [2821] 6/19/2005 Material from the former 3.6 moved here - A domain name (or often just a "domain") consists of one or more
stupid to have two "domains" sections. ]] [[CREF26: [2821] First components, separated by dots if more than one appears. In the case
paragraph below modified to reflect the TLD email address case, of a top-level domain used by itself in an email address, a single
20060422]] A domain name (or often just a "domain") consists of one string is used without any dots. This makes the requirement,
or more components, separated by dots if more than one appears. described in more detail below, that only fully-qualified domain
[[CREF27: [2821] Discussion with Chris Wright names appear in SMTP transactions on the public Internet,
<chris@ausregistry.com.au> 20071125]] In the case of a top-level particularly important where top-level domains are involved. These
domain used by itself in an email address, a single string is used components ("labels" in DNS terminology, RFC 1035 [7]) are restricted
without any dots. This makes the requirement, described in more for SMTP purposes to consist of a sequence of letters, digits, and
detail below, that only fully-qualified domain names appear in SMTP hyphens drawn from the ASCII character set [2] and conforming to what
transactions on the public Internet, particularly important where RFC 1035 Section 2.3.1 calls the "preferred name syntax". Domain
top-level domains are involved. [[CREF28: [2821] Trailing dot text names are used as names of hosts and of other entities in the domain
removed and new text added 20070413, per list discussion and -01 name hierarchy. For example, a domain may refer to an alias (label
issue 1.]] These components ("labels" in DNS terminology, RFC 1035 of a CNAME RR) or the label of Mail eXchanger records to be used to
[7]) are restricted for SMTP purposes to consist of a sequence of deliver mail instead of representing a host name. See RFC 1035 [7]
letters, digits, and hyphens drawn from the ASCII character set [2] and Section 5 of this specification.
and conforming to what RFC 1035 Section 2.3.1 calls the "preferred
name syntax". Domain names are used as names of hosts and of other
entities in the domain name hierarchy. For example, a domain may
refer to an alias (label of a CNAME RR) or the label of Mail
eXchanger records to be used to deliver mail instead of representing
a host name. See RFC 1035 [7] and Section 5 of this specification.
The domain name, as described in this document and in RFC 1035 [7], The domain name, as described in this document and in RFC 1035 [7],
is the entire, fully-qualified name (often referred to as an "FQDN"). is the entire, fully-qualified name (often referred to as an "FQDN").
A domain name that is not in FQDN form is no more than a local alias. A domain name that is not in FQDN form is no more than a local alias.
Local aliases MUST NOT appear in any SMTP transaction. Local aliases MUST NOT appear in any SMTP transaction.
Only resolvable, fully-qualified domain names (FQDNs) are permitted Only resolvable, fully-qualified domain names (FQDNs) are permitted
when domain names are used in SMTP. when domain names are used in SMTP.
[[CREF29: [[5321bis Editor's Note: does "in the public DNS" or [[CREF3: [[5321bis Editor's Note: does "in the public DNS" or
equivalent need to be added to "resolvable"???]]]] equivalent need to be added to "resolvable"???]]]]
In other words, names that can be resolved to MX RRs or address In other words, names that can be resolved to MX RRs or address
(i.e., A or AAAA) RRs (as discussed in Section 5) are permitted, as (i.e., A or AAAA) RRs (as discussed in Section 5) are permitted, as
are CNAME RRs whose targets can be resolved, in turn, to MX or are CNAME RRs whose targets can be resolved, in turn, to MX or
address RRs. address RRs.
[[CREF30: [[5321bis Editor's Note: it is not clear whether "In other [[CREF4: [[5321bis Editor's Note: it is not clear whether "In other
words" really meant "for example" or it is was intended that the only words" really meant "for example" or it is was intended that the only
labels permitted are those that own records in one of the above RR labels permitted are those that own records in one of the above RR
types]]]] types]]]]
[[CREF5: [[5321bis Editor's Note: More generally, does this section
[[CREF31: [[5321bis Editor's Note: More generally, does this section
need work to clarify the relationship to private domain names need work to clarify the relationship to private domain names
(discussed on SMTP list starting 2013-03-26)]]]] (discussed on SMTP list starting 2013-03-26)]]]]
[[CREF32: [2821]Changed "A RR" to "address RR" with the definition Local nicknames or unqualified names MUST NOT be used. There are two
above to accommodate IPv6. Per discussion with SM, sm@resistor.net, exceptions to the rule requiring FQDNs:
20070329.]] Local nicknames or unqualified names MUST NOT be used.
There are two exceptions to the rule requiring FQDNs:
o The domain name given in the EHLO command MUST be either a primary o The domain name given in the EHLO command MUST be either a primary
host name (a domain name that resolves to an address RR) or, if host name (a domain name that resolves to an address RR) or, if
the host has no name, an address literal, as described in the host has no name, an address literal, as described in
Section 4.1.3 and discussed further in the EHLO discussion of Section 4.1.3 and discussed further in the EHLO discussion of
Section 4.1.4. Section 4.1.4.
o The reserved mailbox name "postmaster" may be used in a RCPT o The reserved mailbox name "postmaster" may be used in a RCPT
command without domain qualification (see Section 4.1.1.3) and command without domain qualification (see Section 4.1.1.3) and
MUST be accepted if so used. MUST be accepted if so used.
skipping to change at page 15, line 34 skipping to change at page 14, line 47
SMTP sessions are stateful, with both parties carefully maintaining a SMTP sessions are stateful, with both parties carefully maintaining a
common view of the current state. In this document, we model this common view of the current state. In this document, we model this
state by a virtual "buffer" and a "state table" on the server that state by a virtual "buffer" and a "state table" on the server that
may be used by the client to, for example, "clear the buffer" or may be used by the client to, for example, "clear the buffer" or
"reset the state table", causing the information in the buffer to be "reset the state table", causing the information in the buffer to be
discarded and the state to be returned to some previous state. discarded and the state to be returned to some previous state.
2.3.7. Commands and Replies 2.3.7. Commands and Replies
[[CREF33: [2821]New title, text changes below, and subsequent SMTP commands and, unless altered by a service extension, message
subsection, Tony, 20070504, Issue 23]] SMTP commands and, unless data, are transmitted from the sender to the receiver via the
altered by a service extension, message data, are transmitted from transmission channel in "lines".
the sender to the receiver via the transmission channel in "lines".
An SMTP reply is an acknowledgment (positive or negative) sent in An SMTP reply is an acknowledgment (positive or negative) sent in
"lines" from receiver to sender via the transmission channel in "lines" from receiver to sender via the transmission channel in
response to a command. The general form of a reply is a numeric response to a command. The general form of a reply is a numeric
completion code (indicating failure or success) usually followed by a completion code (indicating failure or success) usually followed by a
text string. The codes are for use by programs and the text is text string. The codes are for use by programs and the text is
usually intended for human users. RFC 3463 [38], specifies further usually intended for human users. RFC 3463 [38], specifies further
structuring of the reply strings, including the use of supplemental structuring of the reply strings, including the use of supplemental
and more specific completion codes (see also RFC 5248 [46]). and more specific completion codes (see also RFC 5248 [46]).
[[CREF34: [2821]Ref added 20080711, Ellerman/Klensin]]
2.3.8. Lines 2.3.8. Lines
Lines consist of zero or more data characters terminated by the Lines consist of zero or more data characters terminated by the
sequence ASCII character "CR" (hex value 0D) followed immediately by sequence ASCII character "CR" (hex value 0D) followed immediately by
ASCII character "LF" (hex value 0A). This termination sequence is ASCII character "LF" (hex value 0A). This termination sequence is
denoted as <CRLF> in this document. Conforming implementations MUST denoted as <CRLF> in this document. Conforming implementations MUST
NOT recognize or generate any other character or character sequence NOT recognize or generate any other character or character sequence
as a line terminator. Limits MAY be imposed on line lengths by as a line terminator. Limits MAY be imposed on line lengths by
servers (see Section 4). servers (see Section 4).
skipping to change at page 16, line 28 skipping to change at page 15, line 34
system as a tool. SMTP client implementations MUST NOT transmit system as a tool. SMTP client implementations MUST NOT transmit
these characters except when they are intended as line terminators these characters except when they are intended as line terminators
and then MUST, as indicated above, transmit them only as a <CRLF> and then MUST, as indicated above, transmit them only as a <CRLF>
sequence. sequence.
2.3.9. Message Content and Mail Data 2.3.9. Message Content and Mail Data
The terms "message content" and "mail data" are used interchangeably The terms "message content" and "mail data" are used interchangeably
in this document to describe the material transmitted after the DATA in this document to describe the material transmitted after the DATA
command is accepted and before the end of data indication is command is accepted and before the end of data indication is
transmitted. Message content includes the message header section transmitted. Message content includes the message header section and
[[CREF35: [2821]Issue 27 20070423]] and the possibly structured the possibly structured message body. The MIME specification (RFC
message body. The MIME specification (RFC 2045 [29]) [[CREF36: 2045 [29]) provides the standard mechanisms for structured message
[2821] Reference corrected Ellerman, 20050901 ]] provides the bodies.
standard mechanisms for structured message bodies.
2.3.10. Originator, Delivery, Relay, and Gateway Systems 2.3.10. Originator, Delivery, Relay, and Gateway Systems
This specification makes a distinction among four types of SMTP This specification makes a distinction among four types of SMTP
systems, based on the role those systems play in transmitting systems, based on the role those systems play in transmitting
electronic mail. An "originating" system (sometimes called an SMTP electronic mail. An "originating" system (sometimes called an SMTP
originator) introduces mail into the Internet or, more generally, originator) introduces mail into the Internet or, more generally,
into a transport service environment. A "delivery" SMTP system is into a transport service environment. A "delivery" SMTP system is
one that receives mail from a transport service environment and one that receives mail from a transport service environment and
passes it to a mail user agent or deposits it in a message store that passes it to a mail user agent or deposits it in a message store that
skipping to change at page 17, line 9 skipping to change at page 16, line 16
A "gateway" SMTP system (usually referred to just as a "gateway") A "gateway" SMTP system (usually referred to just as a "gateway")
receives mail from a client system in one transport environment and receives mail from a client system in one transport environment and
transmits it to a server system in another transport environment. transmits it to a server system in another transport environment.
Differences in protocols or message semantics between the transport Differences in protocols or message semantics between the transport
environments on either side of a gateway may require that the gateway environments on either side of a gateway may require that the gateway
system perform transformations to the message that are not permitted system perform transformations to the message that are not permitted
to SMTP relay systems. For the purposes of this specification, to SMTP relay systems. For the purposes of this specification,
firewalls that rewrite addresses should be considered as gateways, firewalls that rewrite addresses should be considered as gateways,
even if SMTP is used on both sides of them (see RFC 2979 [36]). even if SMTP is used on both sides of them (see RFC 2979 [36]).
[[CREF37: [2821] The placeholder for a general email model that [[CREF6: [5321bis] [[Note in draft/Placeholder: There has been a
appeared in -00 has been removed. ]] [[CREF38: [5321bis] [[Note in request to expand this section, possibly into a more extensive model
draft/Placeholder: There has been a request to expand this section, of Internet mail. Comments from others solicited. In particular,
possibly into a more extensive model of Internet mail. Comments from does RFC 5598 make that suggestion OBE?]] ]]
others solicited. In particular, does RFC 5598 make that suggestion
OBE?]] ]]
2.3.11. Mailbox and Address 2.3.11. Mailbox and Address
[[CREF39: [2821]sections rearranged, per Tony, 20070503]] As used in As used in this specification, an "address" is a character string
this specification, an "address" is a character string that that identifies a user to whom mail will be sent or a location into
identifies a user to whom mail will be sent or a location into which which mail will be deposited. The term "mailbox" refers to that
mail will be deposited. The term "mailbox" refers to that
depository. The two terms are typically used interchangeably unless depository. The two terms are typically used interchangeably unless
the distinction between the location in which mail is placed (the the distinction between the location in which mail is placed (the
mailbox) and a reference to it (the address) is important. An mailbox) and a reference to it (the address) is important. An
address normally consists of user and domain specifications. The address normally consists of user and domain specifications. The
standard mailbox naming convention is defined to be "local- standard mailbox naming convention is defined to be "local-
part@domain"; contemporary usage permits a much broader set of part@domain"; contemporary usage permits a much broader set of
applications than simple "user names". Consequently, and due to a applications than simple "user names". Consequently, and due to a
long history of problems when intermediate hosts have attempted to long history of problems when intermediate hosts have attempted to
optimize transport by modifying them, the local-part MUST be optimize transport by modifying them, the local-part MUST be
interpreted and assigned semantics only by the host specified in the interpreted and assigned semantics only by the host specified in the
domain part of the address. [[CREF40: [2821]Former 'Reply' section, domain part of the address.
2.3.10, which followed, folded into text above, per Tony following
suggestions from Mark Mallett and SM 20070503, issue 23]]
2.4. General Syntax Principles and Transaction Model 2.4. General Syntax Principles and Transaction Model
SMTP commands and replies have a rigid syntax. All commands begin SMTP commands and replies have a rigid syntax. All commands begin
with a command verb. All replies begin with a three digit numeric with a command verb. All replies begin with a three digit numeric
code. In some commands and replies, arguments are required following code. In some commands and replies, arguments are required following
the verb [[CREF41: [2821] rephrased slightly, Ellerman 20050901 ]] or the verb or reply code. Some commands do not accept arguments (after
reply code. Some commands do not accept arguments (after the verb), the verb), and some reply codes are followed, sometimes optionally,
and some reply codes are followed, sometimes optionally, by free form by free form text. In both cases, where text appears, it is
text. In both cases, where text appears, it is separated from the separated from the verb or reply code by a space character. Complete
verb or reply code by a space character. Complete definitions of definitions of commands and replies appear in Section 4.
commands and replies appear in Section 4.
Verbs and argument values (e.g., "TO:" or "to:" in the RCPT command Verbs and argument values (e.g., "TO:" or "to:" in the RCPT command
and extension name keywords) are not case sensitive, with the sole and extension name keywords) are not case sensitive, with the sole
exception in this specification of a mailbox local-part (SMTP exception in this specification of a mailbox local-part (SMTP
Extensions may explicitly specify case-sensitive elements). That is, Extensions may explicitly specify case-sensitive elements). That is,
a command verb, an argument value other than a mailbox local-part, a command verb, an argument value other than a mailbox local-part,
and free form text MAY be encoded in upper case, lower case, or any and free form text MAY be encoded in upper case, lower case, or any
mixture of upper and lower case with no impact on its meaning. mixture of upper and lower case with no impact on its meaning. The
[[CREF42: [2821] sentence removed: This is NOT true of a mailbox local-part of a mailbox MUST BE treated as case sensitive.
local-part. Ellerman 20050901 ]] The local-part of a mailbox MUST BE Therefore, SMTP implementations MUST take care to preserve the case
treated as case sensitive. Therefore, SMTP implementations MUST take of mailbox local-parts. In particular, for some hosts, the user
care to preserve the case of mailbox local-parts. In particular, for "smith" is different from the user "Smith". However, exploiting the
some hosts, the user "smith" is different from the user "Smith". case sensitivity of mailbox local-parts impedes interoperability and
However, exploiting the case sensitivity of mailbox local-parts is discouraged. Mailbox domains follow normal DNS rules and are
impedes interoperability and is discouraged. Mailbox domains follow hence not case sensitive.
normal DNS rules and are hence not case sensitive.
A few SMTP servers, in violation of this specification (and RFC 821) A few SMTP servers, in violation of this specification (and RFC 821)
require that command verbs be encoded by clients in upper case. require that command verbs be encoded by clients in upper case.
Implementations MAY wish to employ this encoding to accommodate those Implementations MAY wish to employ this encoding to accommodate those
servers. servers.
The argument clause consists of a variable-length character string The argument clause consists of a variable-length character string
ending with the end of the line, i.e., with the character sequence ending with the end of the line, i.e., with the character sequence
<CRLF>. The receiver will take no action until this sequence is <CRLF>. The receiver will take no action until this sequence is
received. received.
skipping to change at page 18, line 46 skipping to change at page 17, line 46
next paragraph) MUST NOT transmit messages with information in the next paragraph) MUST NOT transmit messages with information in the
high-order bit of octets. If such messages are transmitted in high-order bit of octets. If such messages are transmitted in
violation of this rule, receiving SMTP servers MAY clear the high- violation of this rule, receiving SMTP servers MAY clear the high-
order bit or reject the message as invalid. In general, a relay SMTP order bit or reject the message as invalid. In general, a relay SMTP
SHOULD assume that the message content it has received is valid and, SHOULD assume that the message content it has received is valid and,
assuming that the envelope permits doing so, relay it without assuming that the envelope permits doing so, relay it without
inspecting that content. Of course, if the content is mislabeled and inspecting that content. Of course, if the content is mislabeled and
the data path cannot accept the actual content, this may result in the data path cannot accept the actual content, this may result in
the ultimate delivery of a severely garbled message to the recipient. the ultimate delivery of a severely garbled message to the recipient.
Delivery SMTP systems MAY reject such messages, or return them as Delivery SMTP systems MAY reject such messages, or return them as
undeliverable, [[CREF43: [2821] Got rid of "bounce" to make Ellerman undeliverable, rather than deliver them. In the absence of a server-
happy, 20070401]] rather than deliver them. In the absence of a offered extension explicitly permitting it, a sending SMTP system is
server-offered extension explicitly permitting it, a sending SMTP not permitted to send envelope commands in any character set other
system is not permitted to send envelope commands in any character than US-ASCII. Receiving systems SHOULD reject such commands,
set other than US-ASCII. Receiving systems SHOULD reject such normally using "500 syntax error - invalid character" replies.
commands, normally using "500 syntax error - invalid character"
replies. [[CREF44: [2821] reworded per SM note 20071017]]
8-bit message content transmission MAY be requested of the server by 8-bit message content transmission MAY be requested of the server by
a client using extended SMTP facilities, notably the "8BITMIME" a client using extended SMTP facilities, notably the "8BITMIME"
extension, RFC 1652 [23]. 8BITMIME SHOULD be supported by SMTP extension, RFC 1652 [23]. 8BITMIME SHOULD be supported by SMTP
servers. However, it MUST NOT be construed as authorization to servers. However, it MUST NOT be construed as authorization to
transmit unrestricted 8-bit material, nor does 8BITMIME authorize transmit unrestricted 8-bit material, nor does 8BITMIME authorize
transmission of any envelope material in other than ASCII. 8BITMIME transmission of any envelope material in other than ASCII. 8BITMIME
MUST NOT be requested by senders for material with the high bit on MUST NOT be requested by senders for material with the high bit on
that is not in MIME format with an appropriate content-transfer that is not in MIME format with an appropriate content-transfer
encoding; servers MAY reject such messages. encoding; servers MAY reject such messages.
The metalinguistic notation used in this document corresponds to the The metalinguistic notation used in this document corresponds to the
"Augmented BNF" used in other Internet mail system documents. The "Augmented BNF" used in other Internet mail system documents. The
reader who is not familiar with that syntax should consult the ABNF reader who is not familiar with that syntax should consult the ABNF
specification in RFC 5234 [5]. Metalanguage terms used in running specification in RFC 5234 [5]. Metalanguage terms used in running
text are surrounded by pointed brackets (e.g., <CRLF>) for clarity. text are surrounded by pointed brackets (e.g., <CRLF>) for clarity.
[[CREF45: [2821]Following inserted per email 20080104, Tony 20080213 The reader is cautioned that the grammar expressed in the
#7b]] The reader is cautioned that the grammar expressed in the
metalanguage is not comprehensive. There are many instances in which metalanguage is not comprehensive. There are many instances in which
provisions in the text constrain or otherwise modify the syntax or provisions in the text constrain or otherwise modify the syntax or
semantics implied by the grammar. semantics implied by the grammar.
3. The SMTP Procedures: An Overview 3. The SMTP Procedures: An Overview
This section contains descriptions of the procedures used in SMTP: This section contains descriptions of the procedures used in SMTP:
session initiation, mail transaction, forwarding mail, verifying session initiation, mail transaction, forwarding mail, verifying
mailbox names and expanding mailing lists, and opening and closing mailbox names and expanding mailing lists, and opening and closing
exchanges. Comments on relaying, a note on mail domains, and a exchanges. Comments on relaying, a note on mail domains, and a
skipping to change at page 20, line 6 skipping to change at page 18, line 49
SMTP server implementations MAY include identification of their SMTP server implementations MAY include identification of their
software and version information in the connection greeting reply software and version information in the connection greeting reply
after the 220 code, a practice that permits more efficient isolation after the 220 code, a practice that permits more efficient isolation
and repair of any problems. Implementations MAY make provision for and repair of any problems. Implementations MAY make provision for
SMTP servers to disable the software and version announcement where SMTP servers to disable the software and version announcement where
it causes security concerns. While some systems also identify their it causes security concerns. While some systems also identify their
contact point for mail problems, this is not a substitute for contact point for mail problems, this is not a substitute for
maintaining the required "postmaster" address (see Section 4). maintaining the required "postmaster" address (see Section 4).
The SMTP protocol allows a server to formally reject a mail session The SMTP protocol allows a server to formally reject a mail session
[[CREF46: [2821]Tony 20080320]] while still allowing the initial while still allowing the initial connection as follows: a 554
connection as follows: a 554 response MAY be given in the initial response MAY be given in the initial connection opening message
connection opening message instead of the 220. A server taking this instead of the 220. A server taking this approach MUST still wait
approach MUST still wait for the client to send a QUIT (see for the client to send a QUIT (see Section 4.1.1.10) before closing
Section 4.1.1.10) before closing the connection and SHOULD respond to the connection and SHOULD respond to any intervening commands with
any intervening commands with "503 bad sequence of commands". Since "503 bad sequence of commands". Since an attempt to make an SMTP
an attempt to make an SMTP connection to such a system is probably in connection to such a system is probably in error, a server returning
error, a server returning a 554 response on connection opening SHOULD a 554 response on connection opening SHOULD provide enough
provide enough information in the reply text to facilitate debugging information in the reply text to facilitate debugging of the sending
of the sending system. system.
3.2. Client Initiation 3.2. Client Initiation
Once the server has sent the greeting (welcoming) message and the Once the server has sent the greeting (welcoming) message and the
client has received it, the client normally sends the EHLO command to client has received it, the client normally sends the EHLO command to
the server, indicating the client's identity. In addition to opening the server, indicating the client's identity. In addition to opening
the session, use of EHLO indicates that the client is able to process the session, use of EHLO indicates that the client is able to process
service extensions and requests that the server provide a list of the service extensions and requests that the server provide a list of the
extensions it supports. Older SMTP systems that are unable to extensions it supports. Older SMTP systems that are unable to
support service extensions, and contemporary clients that do not support service extensions, and contemporary clients that do not
skipping to change at page 21, line 27 skipping to change at page 20, line 22
and examined. Normally, failures produce 550 or 553 replies. and examined. Normally, failures produce 550 or 553 replies.
Historically, the <reverse-path> was permitted to contain more than Historically, the <reverse-path> was permitted to contain more than
just a mailbox; however, contemporary systems SHOULD NOT use source just a mailbox; however, contemporary systems SHOULD NOT use source
routing (see Appendix C). routing (see Appendix C).
The optional <mail-parameters> are associated with negotiated SMTP The optional <mail-parameters> are associated with negotiated SMTP
service extensions (see Section 2.2). service extensions (see Section 2.2).
The second step in the procedure is the RCPT command. This step of The second step in the procedure is the RCPT command. This step of
the procedure can be repeated any number of times. [[CREF47: the procedure can be repeated any number of times.
[2821]Tony 20080213#16]]
RCPT TO:<forward-path> [ SP <rcpt-parameters> ] <CRLF> RCPT TO:<forward-path> [ SP <rcpt-parameters> ] <CRLF>
The first or only argument to this command includes a forward-path The first or only argument to this command includes a forward-path
(normally a mailbox and domain, always surrounded by "<" and ">" (normally a mailbox and domain, always surrounded by "<" and ">"
brackets) identifying one recipient. If accepted, the SMTP server brackets) identifying one recipient. If accepted, the SMTP server
returns a "250 OK" reply and stores the forward-path. If the returns a "250 OK" reply and stores the forward-path. If the
recipient is known not to be a deliverable address, the SMTP server recipient is known not to be a deliverable address, the SMTP server
returns a 550 reply, typically with a string such as "no such user - returns a 550 reply, typically with a string such as "no such user -
" and the mailbox name (other circumstances and reply codes are " and the mailbox name (other circumstances and reply codes are
skipping to change at page 22, line 8 skipping to change at page 20, line 50
routes in the forward-path, but they SHOULD ignore the routes or MAY routes in the forward-path, but they SHOULD ignore the routes or MAY
decline to support the relaying they imply. Similarly, servers MAY decline to support the relaying they imply. Similarly, servers MAY
decline to accept mail that is destined for other hosts or systems. decline to accept mail that is destined for other hosts or systems.
These restrictions make a server useless as a relay for clients that These restrictions make a server useless as a relay for clients that
do not support full SMTP functionality. Consequently, restricted- do not support full SMTP functionality. Consequently, restricted-
capability clients MUST NOT assume that any SMTP server on the capability clients MUST NOT assume that any SMTP server on the
Internet can be used as their mail processing (relaying) site. If a Internet can be used as their mail processing (relaying) site. If a
RCPT command appears without a previous MAIL command, the server MUST RCPT command appears without a previous MAIL command, the server MUST
return a 503 "Bad sequence of commands" response. The optional return a 503 "Bad sequence of commands" response. The optional
<rcpt-parameters> are associated with negotiated SMTP service <rcpt-parameters> are associated with negotiated SMTP service
extensions (see Section 2.2). [[CREF48: [5321bis] JcK Note for extensions (see Section 2.2). [[CREF7: [5321bis] JcK Note for
2821ter (5321bis): this section would be improved by being more 2821ter (5321bis): this section would be improved by being more
specific about where mail transactions begin and end and then talking specific about where mail transactions begin and end and then talking
about "transaction state" here, rather than specific prior commands. about "transaction state" here, rather than specific prior commands.
--JcK]] --JcK]]
Since it has been a common source of errors, it is worth noting that Since it has been a common source of errors, it is worth noting that
spaces are not permitted on either side of the colon following FROM spaces are not permitted on either side of the colon following FROM
in the MAIL command or TO in the RCPT command. The syntax is exactly in the MAIL command or TO in the RCPT command. The syntax is exactly
as given above. [[CREF49: [2821] many comments on ietf-smtp list, as given above.
July 2005. Substituted "common" for "popular" per SM note 20071017,
but did not make the rest of his changes.]]
The third step in the procedure is the DATA command (or some The third step in the procedure is the DATA command (or some
alternative specified in a service extension). alternative specified in a service extension).
DATA <CRLF> DATA <CRLF>
If accepted, the SMTP server returns a 354 Intermediate reply and If accepted, the SMTP server returns a 354 Intermediate reply and
considers all succeeding lines up to but not including the end of considers all succeeding lines up to but not including the end of
mail data indicator to be the message text. When the end of text is mail data indicator to be the message text. When the end of text is
successfully received and stored, the SMTP-receiver sends a "250 OK" successfully received and stored, the SMTP-receiver sends a "250 OK"
skipping to change at page 23, line 16 skipping to change at page 22, line 6
command should fail only if the mail transaction was incomplete (for command should fail only if the mail transaction was incomplete (for
example, no recipients), if resources were unavailable (including, of example, no recipients), if resources were unavailable (including, of
course, the server unexpectedly becoming unavailable), or if the course, the server unexpectedly becoming unavailable), or if the
server determines that the message should be rejected for policy or server determines that the message should be rejected for policy or
other reasons. other reasons.
However, in practice, some servers do not perform recipient However, in practice, some servers do not perform recipient
verification until after the message text is received. These servers verification until after the message text is received. These servers
SHOULD treat a failure for one or more recipients as a "subsequent SHOULD treat a failure for one or more recipients as a "subsequent
failure" and return a mail message as discussed in Section 6 and, in failure" and return a mail message as discussed in Section 6 and, in
particular, in Section 6.1. [[CREF50: [2821]editorial]] Using a "550 particular, in Section 6.1. Using a "550 mailbox not found" (or
mailbox not found" (or equivalent) reply code after the data are equivalent) reply code after the data are accepted makes it difficult
accepted makes it difficult or impossible for the client to determine or impossible for the client to determine which recipients failed.
which recipients failed.
When the RFC 822 format ([16], [11]) is being used, the mail data When the RFC 822 format ([16], [11]) is being used, the mail data
include the header fields such as those named [[CREF51: [2821]Issue include the header fields such as those named Date, Subject, To, Cc,
27 20070423]] Date, Subject, To, Cc, and From. Server SMTP systems and From. Server SMTP systems SHOULD NOT reject messages based on
SHOULD NOT reject messages based on perceived defects in the RFC 822 perceived defects in the RFC 822 or MIME (RFC 2045 [29]) message
or MIME (RFC 2045 [29]) message header section [[CREF52: [2821]Issue header section or message body. In particular, they MUST NOT reject
27 20070423]] or message body. In particular, they MUST NOT reject
messages in which the numbers of Resent-header fields do not match or messages in which the numbers of Resent-header fields do not match or
Resent-to appears without Resent-from and/or Resent-date. Resent-to appears without Resent-from and/or Resent-date.
Mail transaction commands MUST be used in the order discussed above. Mail transaction commands MUST be used in the order discussed above.
3.4. Forwarding for Address Correction or Updating 3.4. Forwarding for Address Correction or Updating
Forwarding support is most often required to consolidate and simplify Forwarding support is most often required to consolidate and simplify
addresses within, or relative to, some enterprise and less frequently addresses within, or relative to, some enterprise and less frequently
to establish addresses to link a person's prior address with a to establish addresses to link a person's prior address with a
skipping to change at page 23, line 50 skipping to change at page 22, line 38
In both the enterprise and the "new address" cases, information In both the enterprise and the "new address" cases, information
hiding (and sometimes security) considerations argue against exposure hiding (and sometimes security) considerations argue against exposure
of the "final" address through the SMTP protocol as a side effect of of the "final" address through the SMTP protocol as a side effect of
the forwarding activity. This may be especially important when the the forwarding activity. This may be especially important when the
final address may not even be reachable by the sender. Consequently, final address may not even be reachable by the sender. Consequently,
the "forwarding" mechanisms described in Section 3.2 of RFC 821, and the "forwarding" mechanisms described in Section 3.2 of RFC 821, and
especially the 251 (corrected destination) and 551 reply codes from especially the 251 (corrected destination) and 551 reply codes from
RCPT must be evaluated carefully by implementers and, when they are RCPT must be evaluated carefully by implementers and, when they are
available, by those configuring systems (see also Section 7.4). available, by those configuring systems (see also Section 7.4).
[[CREF53: [2821]Ref added per Tony Hansen 20070503, Issue 2]]
In particular: In particular:
o Servers MAY forward messages when they are aware of an address o Servers MAY forward messages when they are aware of an address
change. When they do so, they MAY either provide address-updating change. When they do so, they MAY either provide address-updating
information with a 251 code, or may forward "silently" and return information with a 251 code, or may forward "silently" and return
a 250 code. However, if a 251 code is used, they MUST NOT assume a 250 code. However, if a 251 code is used, they MUST NOT assume
that the client will actually update address information or even that the client will actually update address information or even
return that information to the user. return that information to the user.
Alternately, Alternately,
o Servers MAY reject messages or return them as non-deliverable o Servers MAY reject messages or return them as non-deliverable when
[[CREF54: [2821] "bounce" removed, see Ellerman 20070401 ]] when
they cannot be delivered precisely as addressed. When they do so, they cannot be delivered precisely as addressed. When they do so,
they MAY either provide address-updating information with a 551 they MAY either provide address-updating information with a 551
code, or may reject the message as undeliverable with a 550 code code, or may reject the message as undeliverable with a 550 code
and no address-specific information. However, if a 551 code is and no address-specific information. However, if a 551 code is
used, they MUST NOT assume that the client will actually update used, they MUST NOT assume that the client will actually update
address information or even return that information to the user. address information or even return that information to the user.
SMTP server implementations that support the 251 and/or 551 reply SMTP server implementations that support the 251 and/or 551 reply
codes SHOULD provide configuration mechanisms so that sites that codes SHOULD provide configuration mechanisms so that sites that
conclude that they would undesirably disclose information can disable conclude that they would undesirably disclose information can disable
or restrict their use. [[CREF55: [2821]Preferred->Should, etc. or restrict their use.
Issue 16 20070421]]
3.5. Commands for Debugging Addresses 3.5. Commands for Debugging Addresses
3.5.1. Overview 3.5.1. Overview
SMTP provides commands to verify a user name or obtain the content of SMTP provides commands to verify a user name or obtain the content of
a mailing list. This is done with the VRFY and EXPN commands, which a mailing list. This is done with the VRFY and EXPN commands, which
have character string arguments. Implementations SHOULD support VRFY have character string arguments. Implementations SHOULD support VRFY
and EXPN (however, see Section 3.5.2 and Section 7.3). and EXPN (however, see Section 3.5.2 and Section 7.3).
skipping to change at page 26, line 42 skipping to change at page 25, line 28
of file naming conventions in the Internet. Similarly, historical of file naming conventions in the Internet. Similarly, historical
variations in what is returned by these commands are such that the variations in what is returned by these commands are such that the
response SHOULD be interpreted very carefully, if at all, and SHOULD response SHOULD be interpreted very carefully, if at all, and SHOULD
generally only be used for diagnostic purposes. generally only be used for diagnostic purposes.
3.5.2. VRFY Normal Response 3.5.2. VRFY Normal Response
When normal (2yz or 551) responses are returned from a VRFY or EXPN When normal (2yz or 551) responses are returned from a VRFY or EXPN
request, the reply MUST include the <Mailbox> name using a "<local- request, the reply MUST include the <Mailbox> name using a "<local-
part@domain>" construction, where "domain" is a fully-qualified part@domain>" construction, where "domain" is a fully-qualified
domain name.[[CREF56: [2821]Tony 20080320]] In circumstances domain name. In circumstances exceptional enough to justify
exceptional enough to justify violating the intent of this violating the intent of this specification, free-form text MAY be
specification, free-form text MAY be returned. In order to returned. In order to facilitate parsing by both computers and
facilitate parsing by both computers and people, addresses SHOULD people, addresses SHOULD appear in pointed brackets. When addresses,
appear in pointed brackets. When addresses, rather than free-form rather than free-form debugging information, are returned, EXPN and
debugging information, are returned, EXPN and VRFY MUST return only VRFY MUST return only valid domain addresses that are usable in SMTP
valid domain addresses that are usable in SMTP RCPT commands. RCPT commands. Consequently, if an address implies delivery to a
Consequently, if an address implies delivery to a program or other program or other system, the mailbox name used to reach that target
system, the mailbox name used to reach that target MUST be given. MUST be given. Paths (explicit source routes) MUST NOT be returned
Paths (explicit source routes) MUST NOT be returned by VRFY or EXPN. by VRFY or EXPN.
Server implementations SHOULD support both VRFY and EXPN. For Server implementations SHOULD support both VRFY and EXPN. For
security reasons, implementations MAY provide local installations a security reasons, implementations MAY provide local installations a
way to disable either or both of these commands through configuration way to disable either or both of these commands through configuration
options or the equivalent (see Section 7.3). When these commands are options or the equivalent (see Section 7.3). When these commands are
supported, they are not required to work across relays when relaying supported, they are not required to work across relays when relaying
is supported. Since they were both optional in RFC 821, but VRFY was is supported. Since they were both optional in RFC 821, but VRFY was
made mandatory in RFC 1123 [3], if EXPN is supported, it MUST be made mandatory in RFC 1123 [3], if EXPN is supported, it MUST be
listed as a service extension in an EHLO response. [[CREF57: listed as a service extension in an EHLO response. VRFY MAY be
[2821]Ref added, Tony Hansen, 20070503 Issue 2]] VRFY MAY be listed listed as a convenience but, since support for it is required, SMTP
as a convenience but, since support for it is required, SMTP clients clients are not required to check for its presence on the extension
are not required to check for its presence on the extension list list before using it.
before using it. [[CREF58: [2821]20050619: Discussion with Bruce
Lilly 20010721]]
3.5.3. Meaning of VRFY or EXPN Success Response 3.5.3. Meaning of VRFY or EXPN Success Response
A server MUST NOT return a 250 code in response to a VRFY or EXPN A server MUST NOT return a 250 code in response to a VRFY or EXPN
command unless it has actually verified the address. In particular, command unless it has actually verified the address. In particular,
a server MUST NOT return 250 if all it has done is to verify that the a server MUST NOT return 250 if all it has done is to verify that the
syntax given is valid. In that case, 502 (Command not implemented) syntax given is valid. In that case, 502 (Command not implemented)
or 500 (Syntax error, command unrecognized) SHOULD be returned. As or 500 (Syntax error, command unrecognized) SHOULD be returned. As
stated elsewhere, implementation (in the sense of actually validating stated elsewhere, implementation (in the sense of actually validating
addresses and returning information) of VRFY and EXPN are strongly addresses and returning information) of VRFY and EXPN are strongly
skipping to change at page 27, line 39 skipping to change at page 26, line 25
are not in full compliance with this specification. are not in full compliance with this specification.
There may be circumstances where an address appears to be valid but There may be circumstances where an address appears to be valid but
cannot reasonably be verified in real time, particularly when a cannot reasonably be verified in real time, particularly when a
server is acting as a mail exchanger for another server or domain. server is acting as a mail exchanger for another server or domain.
"Apparent validity", in this case, would normally involve at least "Apparent validity", in this case, would normally involve at least
syntax checking and might involve verification that any domains syntax checking and might involve verification that any domains
specified were ones to which the host expected to be able to relay specified were ones to which the host expected to be able to relay
mail. In these situations, reply code 252 SHOULD be returned. These mail. In these situations, reply code 252 SHOULD be returned. These
cases parallel the discussion of RCPT verification in Section 2.1. cases parallel the discussion of RCPT verification in Section 2.1.
[[CREF59: [2821]2005619 Is this right??? ]] Similarly, the discussion Similarly, the discussion in Section 3.4 applies to the use of reply
in Section 3.4 applies to the use of reply codes 251 and 551 with codes 251 and 551 with VRFY (and EXPN) to indicate addresses that are
VRFY (and EXPN) to indicate addresses that are recognized but that recognized but that would be forwarded or rejected were mail received
would be forwarded or rejected [[CREF60: [2821] See Ellerman, for them. Implementations generally SHOULD be more aggressive about
20070401]] were mail received for them. Implementations generally address verification in the case of VRFY than in the case of RCPT,
SHOULD be more aggressive about address verification in the case of even if it takes a little longer to do so.
VRFY than in the case of RCPT, even if it takes a little longer to do
so. [[CREF61: [2821]2821bis-01 Issue 2. Was waiting for additional
text from Ned Freed expected for this section but substituted text
from Tony in -04 and got no further on-list comments.]]
3.5.4. Semantics and Applications of EXPN 3.5.4. Semantics and Applications of EXPN
EXPN is often very useful in debugging and understanding problems EXPN is often very useful in debugging and understanding problems
with mailing lists and multiple-target-address aliases. Some systems with mailing lists and multiple-target-address aliases. Some systems
have attempted to use source expansion of mailing lists as a means of have attempted to use source expansion of mailing lists as a means of
eliminating duplicates. The propagation of aliasing systems with eliminating duplicates. The propagation of aliasing systems with
mail on the Internet for hosts (typically with MX and CNAME DNS mail on the Internet for hosts (typically with MX and CNAME DNS
records), for mailboxes (various types of local host aliases), and in records), for mailboxes (various types of local host aliases), and in
various proxying arrangements has made it nearly impossible for these various proxying arrangements has made it nearly impossible for these
skipping to change at page 28, line 37 skipping to change at page 27, line 15
servers MAY decline to act as mail relays or to accept addresses that servers MAY decline to act as mail relays or to accept addresses that
specify source routes. When route information is encountered, SMTP specify source routes. When route information is encountered, SMTP
servers MAY ignore the route information and simply send to the final servers MAY ignore the route information and simply send to the final
destination specified as the last element in the route and SHOULD do destination specified as the last element in the route and SHOULD do
so. There has been an invalid practice of using names that do not so. There has been an invalid practice of using names that do not
appear in the DNS as destination names, with the senders counting on appear in the DNS as destination names, with the senders counting on
the intermediate hosts specified in source routing to resolve any the intermediate hosts specified in source routing to resolve any
problems. If source routes are stripped, this practice will cause problems. If source routes are stripped, this practice will cause
failures. This is one of several reasons why SMTP clients MUST NOT failures. This is one of several reasons why SMTP clients MUST NOT
generate invalid source routes or depend on serial resolution of generate invalid source routes or depend on serial resolution of
names in such routes. [[CREF62: [5321bis] Jck 20091023: "of names in such routes. [[CREF8: [5321bis] Jck 20091023: "of names..."
names..." added for clarity"]] added for clarity"]]
When source routes are not used, the process described in RFC 821 for When source routes are not used, the process described in RFC 821 for
constructing a reverse-path from the forward-path is not applicable constructing a reverse-path from the forward-path is not applicable
and the reverse-path at the time of delivery will simply be the and the reverse-path at the time of delivery will simply be the
address that appeared in the MAIL command. address that appeared in the MAIL command.
3.6.2. Mail eXchange Records and Relaying 3.6.2. Mail eXchange Records and Relaying
A relay SMTP server is usually the target of a DNS MX record that A relay SMTP server is usually the target of a DNS MX record that
designates it, rather than the final delivery system. The relay designates it, rather than the final delivery system. The relay
skipping to change at page 29, line 32 skipping to change at page 28, line 16
Many mail-sending clients exist, especially in conjunction with Many mail-sending clients exist, especially in conjunction with
facilities that receive mail via POP3 or IMAP, that have limited facilities that receive mail via POP3 or IMAP, that have limited
capability to support some of the requirements of this specification, capability to support some of the requirements of this specification,
such as the ability to queue messages for subsequent delivery such as the ability to queue messages for subsequent delivery
attempts. For these clients, it is common practice to make private attempts. For these clients, it is common practice to make private
arrangements to send all messages to a single server for processing arrangements to send all messages to a single server for processing
and subsequent distribution. SMTP, as specified here, is not ideally and subsequent distribution. SMTP, as specified here, is not ideally
suited for this role. A standardized mail submission protocol has suited for this role. A standardized mail submission protocol has
been developed that is gradually superseding practices based on SMTP been developed that is gradually superseding practices based on SMTP
(see RFC 4409 [43]). [[CREF63: [2821]Since Submit is now a Draft (see RFC 4409 [43]). In any event, because these arrangements are
Standard, the vague language in 2821 no longer seems appropriate private and fall outside the scope of this specification, they are
20070331 ]] In any event, because these arrangements are private and not described here.
fall outside the scope of this specification, they are not described
here.
It is important to note that MX records can point to SMTP servers It is important to note that MX records can point to SMTP servers
that act as gateways into other environments, not just SMTP relays that act as gateways into other environments, not just SMTP relays
and final delivery systems; see Sections 3.7 and 5. and final delivery systems; see Sections 3.7 and 5.
If an SMTP server has accepted the task of relaying the mail and If an SMTP server has accepted the task of relaying the mail and
later finds that the destination is incorrect or that the mail cannot later finds that the destination is incorrect or that the mail cannot
be delivered for some other reason, then it MUST construct an be delivered for some other reason, then it MUST construct an
"undeliverable mail" notification message and send it to the "undeliverable mail" notification message and send it to the
originator of the undeliverable mail (as indicated by the reverse- originator of the undeliverable mail (as indicated by the reverse-
skipping to change at page 30, line 18 skipping to change at page 28, line 46
messages about problems transporting notification messages. One way messages about problems transporting notification messages. One way
to prevent loops in error reporting is to specify a null reverse-path to prevent loops in error reporting is to specify a null reverse-path
in the MAIL command of a notification message. When such a message in the MAIL command of a notification message. When such a message
is transmitted, the reverse-path MUST be set to null (see is transmitted, the reverse-path MUST be set to null (see
Section 4.5.5 for additional discussion). A MAIL command with a null Section 4.5.5 for additional discussion). A MAIL command with a null
reverse-path appears as follows: reverse-path appears as follows:
MAIL FROM:<> MAIL FROM:<>
As discussed in Section 6.4, a relay SMTP has no need to inspect or As discussed in Section 6.4, a relay SMTP has no need to inspect or
act upon the header section [[CREF64: [2821]Issue 27 20070423]] or act upon the header section or body of the message data and MUST NOT
body of the message data and MUST NOT do so except to add its own do so except to add its own "Received:" header field (Section 4.4)
"Received:" header field (Section 4.4) and, optionally, to attempt to and, optionally, to attempt to detect looping in the mail system (see
detect looping in the mail system (see Section 6.3). Of course, this Section 6.3). Of course, this prohibition also applies to any
prohibition also applies to any modifications of these header fields modifications of these header fields or text (see also Section 7.9).
or text (see also Section 7.9).
3.7. Mail Gatewaying 3.7. Mail Gatewaying
While the relay function discussed above operates within the Internet While the relay function discussed above operates within the Internet
SMTP transport service environment, MX records or various forms of SMTP transport service environment, MX records or various forms of
explicit routing may require that an intermediate SMTP server perform explicit routing may require that an intermediate SMTP server perform
a translation function between one transport service and another. As a translation function between one transport service and another. As
discussed in Section 2.3.10, when such a system is at the boundary discussed in Section 2.3.10, when such a system is at the boundary
between two transport service environments, we refer to it as a between two transport service environments, we refer to it as a
"gateway" or "gateway SMTP". "gateway" or "gateway SMTP".
skipping to change at page 30, line 49 skipping to change at page 29, line 29
environment. environment.
3.7.1. Header Fields in Gatewaying 3.7.1. Header Fields in Gatewaying
Header fields MAY be rewritten when necessary as messages are Header fields MAY be rewritten when necessary as messages are
gatewayed across mail environment boundaries. This may involve gatewayed across mail environment boundaries. This may involve
inspecting the message body or interpreting the local-part of the inspecting the message body or interpreting the local-part of the
destination address in spite of the prohibitions in Section 6.4. destination address in spite of the prohibitions in Section 6.4.
Other mail systems gatewayed to the Internet often use a subset of Other mail systems gatewayed to the Internet often use a subset of
the RFC 822 header section [[CREF65: [2821]Issue 27 20070423]] or the RFC 822 header section or provide similar functionality with a
provide similar functionality with a different syntax, but some of different syntax, but some of these mail systems do not have an
these mail systems do not have an equivalent to the SMTP envelope. equivalent to the SMTP envelope. Therefore, when a message leaves
Therefore, when a message leaves the Internet environment, it may be the Internet environment, it may be necessary to fold the SMTP
necessary to fold the SMTP envelope information into the message envelope information into the message header section. A possible
header section. [[CREF66: [2821]Issue 27 20070423]] A possible
solution would be to create new header fields to carry the envelope solution would be to create new header fields to carry the envelope
information (e.g., "X-SMTP-MAIL:" and "X-SMTP-RCPT:"); however, this information (e.g., "X-SMTP-MAIL:" and "X-SMTP-RCPT:"); however, this
would require changes in mail programs in foreign environments and would require changes in mail programs in foreign environments and
might risk disclosure of private information (see Section 7.2). might risk disclosure of private information (see Section 7.2).
3.7.2. Received Lines in Gatewaying 3.7.2. Received Lines in Gatewaying
When forwarding a message into or out of the Internet environment, a When forwarding a message into or out of the Internet environment, a
gateway MUST prepend a Received: line, but it MUST NOT alter in any gateway MUST prepend a Received: line, but it MUST NOT alter in any
way a Received: line that is already in the header section. way a Received: line that is already in the header section.
[[CREF67: [2821]Issue 27 20070423]]
"Received:" header fields of messages originating from other "Received:" header fields of messages originating from other
environments may not conform exactly to this specification. However, environments may not conform exactly to this specification. However,
the most important use of Received: lines is for debugging mail the most important use of Received: lines is for debugging mail
faults, and this debugging can be severely hampered by well-meaning faults, and this debugging can be severely hampered by well-meaning
gateways that try to "fix" a Received: line. As another consequence gateways that try to "fix" a Received: line. As another consequence
of trace header fields arising in non-SMTP environments, receiving of trace header fields arising in non-SMTP environments, receiving
systems MUST NOT reject mail based on the format of a trace header systems MUST NOT reject mail based on the format of a trace header
field and SHOULD be extremely robust in the light of unexpected field and SHOULD be extremely robust in the light of unexpected
information or formats in those header fields. information or formats in those header fields.
The gateway SHOULD indicate the environment and protocol in the "via" The gateway SHOULD indicate the environment and protocol in the "via"
clauses of Received header field(s) that it supplies. clauses of Received header field(s) that it supplies.
3.7.3. Addresses in Gatewaying 3.7.3. Addresses in Gatewaying
From the Internet side, the gateway SHOULD accept all valid address From the Internet side, the gateway SHOULD accept all valid address
formats in SMTP commands and in the RFC 822 header section, [[CREF68: formats in SMTP commands and in the RFC 822 header section, and all
[2821]Issue 27 20070423]] and all valid RFC 822 messages. Addresses valid RFC 822 messages. Addresses and header fields generated by
and header fields generated by gateways MUST conform to applicable gateways MUST conform to applicable standards (including this one and
standards (including this one and RFC 5322 [11]). Gateways are, of RFC 5322 [11]). Gateways are, of course, subject to the same rules
course, subject to the same rules for handling source routes as those for handling source routes as those described for other SMTP systems
described for other SMTP systems in Section 3.3. in Section 3.3.
3.7.4. Other Header Fields in Gatewaying 3.7.4. Other Header Fields in Gatewaying
The gateway MUST ensure that all header fields of a message that it The gateway MUST ensure that all header fields of a message that it
forwards into the Internet mail environment meet the requirements for forwards into the Internet mail environment meet the requirements for
Internet mail. In particular, all addresses in "From:", "To:", Internet mail. In particular, all addresses in "From:", "To:",
"Cc:", etc., header fields MUST be transformed (if necessary) to "Cc:", etc., header fields MUST be transformed (if necessary) to
satisfy the standard header syntax of RFC 5322 [11], [[CREF69: satisfy the standard header syntax of RFC 5322 [11], MUST reference
[2821]JcK 20050901: changed for consistency, 2821 referenced 822]] only fully-qualified domain names, and MUST be effective and useful
MUST reference only fully-qualified domain names, and MUST be for sending replies. The translation algorithm used to convert mail
effective and useful for sending replies. The translation algorithm from the Internet protocols to another environment's protocol SHOULD
used to convert mail from the Internet protocols to another ensure that error messages from the foreign mail environment are
environment's protocol SHOULD ensure that error messages from the delivered to the reverse-path from the SMTP envelope, not to an
foreign mail environment are delivered to the reverse-path from the address in the "From:", "Sender:", or similar header fields of the
SMTP envelope, not to an address in the "From:", "Sender:", or message.
similar header fields of the message. [[CREF70: [2821] Per Frank
Ellerman 20070426]]
3.7.5. Envelopes in Gatewaying 3.7.5. Envelopes in Gatewaying
Similarly, when forwarding a message from another environment into Similarly, when forwarding a message from another environment into
the Internet, the gateway SHOULD set the envelope return path in the Internet, the gateway SHOULD set the envelope return path in
accordance with an error message return address, if supplied by the accordance with an error message return address, if supplied by the
foreign environment. If the foreign environment has no equivalent foreign environment. If the foreign environment has no equivalent
concept, the gateway must select and use a best approximation, with concept, the gateway must select and use a best approximation, with
the message originator's address as the default of last resort. the message originator's address as the default of last resort.
skipping to change at page 32, line 37 skipping to change at page 31, line 14
o After receiving a QUIT command and responding with a 221 reply. o After receiving a QUIT command and responding with a 221 reply.
o After detecting the need to shut down the SMTP service and o After detecting the need to shut down the SMTP service and
returning a 421 reply code. This reply code can be issued after returning a 421 reply code. This reply code can be issued after
the server receives any command or, if necessary, asynchronously the server receives any command or, if necessary, asynchronously
from command receipt (on the assumption that the client will from command receipt (on the assumption that the client will
receive it after the next command is issued). receive it after the next command is issued).
o After a timeout, as specified in Section 4.5.3.2, occurs waiting o After a timeout, as specified in Section 4.5.3.2, occurs waiting
for the client to send a command or data. [[CREF71: for the client to send a command or data.
[2821]20050619 The previous text caused considerable controversy
in a thread initiated by Paul Smith <paul@pscs.co.uk> around
20040107. The issue turns less on the question of whether a
server closing a connection on timeout is an intentional act or
not, but whether it is wise to break the SMTP command-response
model by encouraging unsolicited replies in this case. The text
reflects the 'no unsolicited/ asynchronous replies' model]]
[[CREF72: [2821] 20050619 Per discussion with Jutta Degener,
20030730. Without this, the text is clearly wrong. ]]
In particular, a server that closes connections in response to In particular, a server that closes connections in response to
commands that are not understood is in violation of this commands that are not understood is in violation of this
specification. Servers are expected to be tolerant of unknown specification. Servers are expected to be tolerant of unknown
commands, issuing a 500 reply and awaiting further instructions from commands, issuing a 500 reply and awaiting further instructions from
the client. the client.
An SMTP server that is forcibly shut down via external means SHOULD An SMTP server that is forcibly shut down via external means SHOULD
attempt to send a line containing a 421 reply code to the SMTP client attempt to send a line containing a 421 reply code to the SMTP client
before exiting. The SMTP client will normally read the 421 reply before exiting. The SMTP client will normally read the 421 reply
skipping to change at page 33, line 21 skipping to change at page 31, line 36
SMTP clients that experience a connection close, reset, or other SMTP clients that experience a connection close, reset, or other
communications failure due to circumstances not under their control communications failure due to circumstances not under their control
(in violation of the intent of this specification but sometimes (in violation of the intent of this specification but sometimes
unavoidable) SHOULD, to maintain the robustness of the mail system, unavoidable) SHOULD, to maintain the robustness of the mail system,
treat the mail transaction as if a 421 response had been received and treat the mail transaction as if a 421 response had been received and
act accordingly. act accordingly.
3.9. Mailing Lists and Aliases 3.9. Mailing Lists and Aliases
[[CREF73: [5321bis] If "alias and list models" are explained [[CREF9: [5321bis] If "alias and list models" are explained
elsewhere, cross reference". Also note that this section appears to elsewhere, cross reference". Also note that this section appears to
prohibit an exploder from adding List-* headers. That needs to be prohibit an exploder from adding List-* headers. That needs to be
finessed.]] finessed.]]
An SMTP-capable host SHOULD support both the alias and the list An SMTP-capable host SHOULD support both the alias and the list
models of address expansion for multiple delivery. When a message is models of address expansion for multiple delivery. When a message is
delivered or forwarded to each address of an expanded list form, the delivered or forwarded to each address of an expanded list form, the
return address in the envelope ("MAIL FROM:") MUST be changed to be return address in the envelope ("MAIL FROM:") MUST be changed to be
the address of a person or other entity who administers the list. the address of a person or other entity who administers the list.
However, in this case, the message header section (RFC 5322 [11]) However, in this case, the message header section (RFC 5322 [11])
[[CREF74: [2821]Issue 27 20070423]] MUST be left unchanged; in MUST be left unchanged; in particular, the "From" field of the header
particular, the "From" field of the header section is unaffected. section is unaffected.
An important mail facility is a mechanism for multi-destination An important mail facility is a mechanism for multi-destination
delivery of a single message, by transforming (or "expanding" or delivery of a single message, by transforming (or "expanding" or
"exploding") a pseudo-mailbox address into a list of destination "exploding") a pseudo-mailbox address into a list of destination
mailbox addresses. When a message is sent to such a pseudo-mailbox mailbox addresses. When a message is sent to such a pseudo-mailbox
(sometimes called an "exploder"), copies are forwarded or (sometimes called an "exploder"), copies are forwarded or
redistributed to each mailbox in the expanded list. Servers SHOULD redistributed to each mailbox in the expanded list. Servers SHOULD
simply utilize the addresses on the list; application of heuristics simply utilize the addresses on the list; application of heuristics
or other matching rules to eliminate some addresses, such as that of or other matching rules to eliminate some addresses, such as that of
the originator, is strongly discouraged. We classify such a pseudo- the originator, is strongly discouraged. We classify such a pseudo-
skipping to change at page 34, line 19 skipping to change at page 32, line 32
A mailing list may be said to operate by "redistribution" rather than A mailing list may be said to operate by "redistribution" rather than
by "forwarding". To expand a list, the recipient mailer replaces the by "forwarding". To expand a list, the recipient mailer replaces the
pseudo-mailbox address in the envelope with each of the expanded pseudo-mailbox address in the envelope with each of the expanded
addresses in turn. The return (backward-pointing) address in the addresses in turn. The return (backward-pointing) address in the
envelope is changed so that all error messages generated by the final envelope is changed so that all error messages generated by the final
deliveries will be returned to a list administrator, not to the deliveries will be returned to a list administrator, not to the
message originator, who generally has no control over the contents of message originator, who generally has no control over the contents of
the list and will typically find error messages annoying. Note that the list and will typically find error messages annoying. Note that
the key difference between handling aliases (Section 3.9.1) and the key difference between handling aliases (Section 3.9.1) and
forwarding (this subsection) is the change to the backward-pointing forwarding (this subsection) is the change to the backward-pointing
address in this case. [[CREF75: [2821]Mark E Mallet note 20070418, address in this case. When a list constrains its processing to the
JcK 20070422]] When a list constrains its processing to the very very limited set of modifications and actions described here, it is
limited set of modifications and actions described here, it is
attempting to emulate an MTA; such lists can be treated as a attempting to emulate an MTA; such lists can be treated as a
continuation in email transit. [[CREF76: [2821]Tony 20080213 #11]] continuation in email transit.
There exist mailing lists that perform additional, sometimes There exist mailing lists that perform additional, sometimes
extensive, modifications to a message and its envelope. Such mailing extensive, modifications to a message and its envelope. Such mailing
lists need to be viewed as full MUAs, which accept a delivery and lists need to be viewed as full MUAs, which accept a delivery and
post a new message. [[CREF77: [2821]SM 20080220]] post a new message.
4. The SMTP Specifications 4. The SMTP Specifications
4.1. SMTP Commands 4.1. SMTP Commands
4.1.1. Command Semantics and Syntax 4.1.1. Command Semantics and Syntax
The SMTP commands define the mail transfer or the mail system The SMTP commands define the mail transfer or the mail system
function requested by the user. SMTP commands are character strings function requested by the user. SMTP commands are character strings
terminated by <CRLF>. The commands themselves are alphabetic terminated by <CRLF>. The commands themselves are alphabetic
characters terminated by <SP> if parameters follow and <CRLF> characters terminated by <SP> if parameters follow and <CRLF>
otherwise. (In the interest of improved interoperability, SMTP otherwise. (In the interest of improved interoperability, SMTP
receivers SHOULD tolerate trailing white space before the terminating receivers SHOULD tolerate trailing white space before the terminating
<CRLF>.) [[CREF78: [2821]Preferred->Should, etc. Issue 16 <CRLF>.) The syntax of the local part of a mailbox MUST conform to
20070421]] The syntax of the local part of a mailbox MUST conform to
receiver site conventions and the syntax specified in Section 4.1.2. receiver site conventions and the syntax specified in Section 4.1.2.
The SMTP commands are discussed below. The SMTP replies are The SMTP commands are discussed below. The SMTP replies are
discussed in Section 4.2. discussed in Section 4.2.
A mail transaction involves several data objects that are A mail transaction involves several data objects that are
communicated as arguments to different commands. The reverse-path is communicated as arguments to different commands. The reverse-path is
the argument of the MAIL command, the forward-path is the argument of the argument of the MAIL command, the forward-path is the argument of
the RCPT command, and the mail data is the argument of the DATA the RCPT command, and the mail data is the argument of the DATA
command. These arguments or data objects must be transmitted and command. These arguments or data objects must be transmitted and
held, pending the confirmation communicated by the end of mail data held, pending the confirmation communicated by the end of mail data
skipping to change at page 35, line 33 skipping to change at page 33, line 44
SMTP client system does not have a meaningful domain name (e.g., when SMTP client system does not have a meaningful domain name (e.g., when
its address is dynamically allocated and no reverse mapping record is its address is dynamically allocated and no reverse mapping record is
available), the client SHOULD send an address literal (see available), the client SHOULD send an address literal (see
Section 4.1.3). Section 4.1.3).
RFC 2821, and some earlier informal practices, encouraged following RFC 2821, and some earlier informal practices, encouraged following
the literal by information that would help to identify the client the literal by information that would help to identify the client
system. That convention was not widely supported, and many SMTP system. That convention was not widely supported, and many SMTP
servers considered it an error. In the interest of interoperability, servers considered it an error. In the interest of interoperability,
it is probably wise for servers to be prepared for this string to it is probably wise for servers to be prepared for this string to
occur, but SMTP clients SHOULD NOT send it. [[CREF79: occur, but SMTP clients SHOULD NOT send it.
[2821]Suggestion that the explanation be included dropped and
replaced by the explanation above, 20070511, Issue 19.]]
The SMTP server identifies itself to the SMTP client in the The SMTP server identifies itself to the SMTP client in the
connection greeting reply and in the response to this command. connection greeting reply and in the response to this command.
A client SMTP SHOULD start an SMTP session by issuing the EHLO A client SMTP SHOULD start an SMTP session by issuing the EHLO
command. If the SMTP server supports the SMTP service extensions, it command. If the SMTP server supports the SMTP service extensions, it
will give a successful response, a failure response, or an error will give a successful response, a failure response, or an error
response. If the SMTP server, in violation of this specification, response. If the SMTP server, in violation of this specification,
does not support any SMTP service extensions, it will generate an does not support any SMTP service extensions, it will generate an
error response. Older client SMTP systems MAY, as discussed above, error response. Older client SMTP systems MAY, as discussed above,
skipping to change at page 36, line 10 skipping to change at page 34, line 19
client MUST issue HELO or EHLO before starting a mail transaction. client MUST issue HELO or EHLO before starting a mail transaction.
These commands, and a "250 OK" reply to one of them, confirm that These commands, and a "250 OK" reply to one of them, confirm that
both the SMTP client and the SMTP server are in the initial state, both the SMTP client and the SMTP server are in the initial state,
that is, there is no transaction in progress and all state tables and that is, there is no transaction in progress and all state tables and
buffers are cleared. buffers are cleared.
Syntax: Syntax:
ehlo = "EHLO" SP ( Domain / address-literal ) CRLF ehlo = "EHLO" SP ( Domain / address-literal ) CRLF
[[CREF80: [2821]Explained literal removed, here and
below, in 04d, 20070511, Issue 19 ]]
helo = "HELO" SP Domain CRLF helo = "HELO" SP Domain CRLF
Normally, the response to EHLO will be a multiline reply. Each line Normally, the response to EHLO will be a multiline reply. Each line
of the response contains a keyword and, optionally, one or more of the response contains a keyword and, optionally, one or more
parameters. Following the normal syntax for multiline replies, these parameters. Following the normal syntax for multiline replies, these
keywords follow the code (250) and a hyphen for all but the last keywords follow the code (250) and a hyphen for all but the last
line, and the code and a space for the last line. The syntax for a line, and the code and a space for the last line. The syntax for a
positive response, using the ABNF notation and terminal symbols of positive response, using the ABNF notation and terminal symbols of
RFC 5234 [5], is: RFC 5234 [5], is:
ehlo-ok-rsp = ( "250" SP Domain [ SP ehlo-greet ] CRLF ) ehlo-ok-rsp = ( "250" SP Domain [ SP ehlo-greet ] CRLF )
[[CREF81: [2821]20050619 Mail from "Richard O. / ( "250-" Domain [ SP ehlo-greet ] CRLF
Hammer" <ROHammer@EarthLink.net> 20031223.]]
[[CREF82: [2821]20080222 Tony Hansen -- remove extra
blank line]] / ( "250-" Domain [ SP ehlo-greet ]
CRLF
*( "250-" ehlo-line CRLF ) *( "250-" ehlo-line CRLF )
"250" SP ehlo-line CRLF ) "250" SP ehlo-line CRLF )
ehlo-greet = 1*(%d0-9 / %d11-12 / %d14-127) ehlo-greet = 1*(%d0-9 / %d11-12 / %d14-127)
[[CREF83: [2821]20080222 Tony Hansen -- remove extra ; string of any characters other than CR or LF
blank line]] ; string of any characters other than
CR or LF
ehlo-line = ehlo-keyword *( SP ehlo-param ) ehlo-line = ehlo-keyword *( SP ehlo-param )
ehlo-keyword = (ALPHA / DIGIT) *(ALPHA / DIGIT / "-") ehlo-keyword = (ALPHA / DIGIT) *(ALPHA / DIGIT / "-")
[[CREF84: [2821]20080222 Tony Hansen -- remove extra ; additional syntax of ehlo-params depends on
blank line]] ; additional syntax of ehlo-params
depends on
; ehlo-keyword ; ehlo-keyword
ehlo-param = 1*(%d33-126) ehlo-param = 1*(%d33-126)
[[CREF85: [2821]20080222 Tony Hansen -- remove extra ; any CHAR excluding <SP> and all
blank line]] ; any CHAR excluding <SP> and all
; control characters (US-ASCII 0-31 and 127 ; control characters (US-ASCII 0-31 and 127
; inclusive) ; inclusive)
Although EHLO keywords may be specified in upper, lower, or mixed Although EHLO keywords may be specified in upper, lower, or mixed
case, they MUST always be recognized and processed in a case- case, they MUST always be recognized and processed in a case-
insensitive manner. This is simply an extension of practices insensitive manner. This is simply an extension of practices
specified in RFC 821 and [[CREF86: [2821] 20050619 Bortzmeyer/ specified in RFC 821 and Section 2.4.
Kletnieks, 20050513 ]] Section 2.4.
The EHLO response MUST contain keywords (and associated parameters if The EHLO response MUST contain keywords (and associated parameters if
required) for all commands not listed as "required" in Section 4.5.1 required) for all commands not listed as "required" in Section 4.5.1
excepting only private-use commands as described in Section 4.1.5. excepting only private-use commands as described in Section 4.1.5.
Private-use commands MAY be listed. [[CREF87: [2821]20050619 This Private-use commands MAY be listed.
clarifies a long-term ambiguity. See note to IETF list from
Sabahattin Gucukoglu <mail@sabahattin-gucukoglu.com>, 20040119]]
4.1.1.2. MAIL (MAIL) 4.1.1.2. MAIL (MAIL)
This command is used to initiate a mail transaction in which the mail This command is used to initiate a mail transaction in which the mail
data is delivered to an SMTP server that may, in turn, deliver it to data is delivered to an SMTP server that may, in turn, deliver it to
one or more mailboxes or pass it on to another system (possibly using one or more mailboxes or pass it on to another system (possibly using
SMTP). The argument clause contains a reverse-path and may contain SMTP). The argument clause contains a reverse-path and may contain
optional parameters. In general, the MAIL command may be sent only optional parameters. In general, the MAIL command may be sent only
when no mail transaction is in progress, see Section 4.1.4. when no mail transaction is in progress, see Section 4.1.4.
skipping to change at page 37, line 43 skipping to change at page 35, line 37
This command clears the reverse-path buffer, the forward-path buffer, This command clears the reverse-path buffer, the forward-path buffer,
and the mail data buffer, and it inserts the reverse-path information and the mail data buffer, and it inserts the reverse-path information
from its argument clause into the reverse-path buffer. from its argument clause into the reverse-path buffer.
If service extensions were negotiated, the MAIL command may also If service extensions were negotiated, the MAIL command may also
carry parameters associated with a particular service extension. carry parameters associated with a particular service extension.
Syntax: Syntax:
mail = "MAIL FROM:" Reverse-path [[CREF88: [2821]20050619 Per mail = "MAIL FROM:" Reverse-path
Bruce Lilly, 20050228 - move the empty path
construction to the Reverse-path production.]]
[[CREF89: [2821]20080222 Tony Hansen -- add production
token]]
[SP Mail-parameters] CRLF [SP Mail-parameters] CRLF
4.1.1.3. RECIPIENT (RCPT) 4.1.1.3. RECIPIENT (RCPT)
This command is used to identify an individual recipient of the mail This command is used to identify an individual recipient of the mail
data; multiple recipients are specified by multiple uses of this data; multiple recipients are specified by multiple uses of this
command. The argument clause contains a forward-path and may contain command. The argument clause contains a forward-path and may contain
optional parameters. optional parameters.
The forward-path normally consists of the required destination The forward-path normally consists of the required destination
skipping to change at page 39, line 6 skipping to change at page 36, line 41
MAIL FROM:<userx@y.foo.org> MAIL FROM:<userx@y.foo.org>
RCPT TO:<@hosta.int,@jkl.org:userc@d.bar.org> RCPT TO:<@hosta.int,@jkl.org:userc@d.bar.org>
or to jkl.org, using the envelope commands or to jkl.org, using the envelope commands
MAIL FROM:<userx@y.foo.org> MAIL FROM:<userx@y.foo.org>
RCPT TO:<@jkl.org:userc@d.bar.org> RCPT TO:<@jkl.org:userc@d.bar.org>
Attempting to use relaying this way is now strongly discouraged. Attempting to use relaying this way is now strongly discouraged.
[[CREF90: [2821]Klensin 20070414 in response to comments from SM -- Since hosts are not required to relay mail at all, xyz.com MAY also
we really should not be encouraging this any more, even at the MAY reject the message entirely when the RCPT command is received, using
level.]] Since hosts are not required to relay mail at all, xyz.com a 550 code (since this is a "policy reason").
MAY also reject the message entirely when the RCPT command is
received, using a 550 code (since this is a "policy reason").
If service extensions were negotiated, the RCPT command may also If service extensions were negotiated, the RCPT command may also
carry parameters associated with a particular service extension carry parameters associated with a particular service extension
offered by the server. The client MUST NOT transmit parameters other offered by the server. The client MUST NOT transmit parameters other
than those associated with a service extension offered by the server than those associated with a service extension offered by the server
in its EHLO response. in its EHLO response.
Syntax: Syntax:
rcpt = "RCPT TO:" ( "<Postmaster@" Domain ">" / "<Postmaster>" / rcpt = "RCPT TO:" ( "<Postmaster@" Domain ">" / "<Postmaster>" /
Forward-path ) [SP Rcpt-parameters] CRLF [[CREF91: Forward-path ) [SP Rcpt-parameters] CRLF
[2821]20080222 Tony Hansen -- add production token]]
Note that, in a departure from the usual rules for Note that, in a departure from the usual rules for
local-parts, the "Postmaster" string shown above is local-parts, the "Postmaster" string shown above is
treated as case-insensitive. treated as case-insensitive.
4.1.1.4. DATA (DATA) 4.1.1.4. DATA (DATA)
The receiver normally sends a 354 response to DATA, and then treats The receiver normally sends a 354 response to DATA, and then treats
the lines (strings ending in <CRLF> sequences, as described in the lines (strings ending in <CRLF> sequences, as described in
Section 2.3.7) following the command as mail data from the sender. Section 2.3.7) following the command as mail data from the sender.
skipping to change at page 39, line 48 skipping to change at page 37, line 32
The mail data are terminated by a line containing only a period, that The mail data are terminated by a line containing only a period, that
is, the character sequence "<CRLF>.<CRLF>", where the first <CRLF> is is, the character sequence "<CRLF>.<CRLF>", where the first <CRLF> is
actually the terminator of the previous line (see Section 4.5.2). actually the terminator of the previous line (see Section 4.5.2).
This is the end of mail data indication. The first <CRLF> of this This is the end of mail data indication. The first <CRLF> of this
terminating sequence is also the <CRLF> that ends the final line of terminating sequence is also the <CRLF> that ends the final line of
the data (message text) or, if there was no mail data, ends the DATA the data (message text) or, if there was no mail data, ends the DATA
command itself (the "no mail data" case does not conform to this command itself (the "no mail data" case does not conform to this
specification since it would require that neither the trace header specification since it would require that neither the trace header
fields required by this specification nor the message header section fields required by this specification nor the message header section
[[CREF92: [2821]Issue 27 20070423]] required by RFC 5322 [11] be required by RFC 5322 [11] be transmitted). An extra <CRLF> MUST NOT
transmitted). [[CREF93: [2821]20050619 Text clarified in response to be added, as that would cause an empty line to be added to the
a thread initiated by "Richard O. Hammer" <ROHammer@earthlink.net>, message. The only exception to this rule would arise if the message
20030620. The original seems clear to me - "that is..." does not body were passed to the originating SMTP-sender with a final "line"
make the character sequence into the definition of a line - but this that did not end in <CRLF>; in that case, the originating SMTP system
may confuse fewer readers.]] An extra <CRLF> MUST NOT be added, as MUST either reject the message as invalid or add <CRLF> in order to
that would cause an empty line to be added to the message. The only have the receiving SMTP server recognize the "end of data" condition.
exception to this rule would arise if the message body were passed to
the originating SMTP-sender with a final "line" that did not end in
<CRLF>; in that case, the originating SMTP system MUST either reject
the message as invalid or add <CRLF> in order to have the receiving
SMTP server recognize the "end of data" condition.
The custom of accepting lines ending only in <LF>, as a concession to The custom of accepting lines ending only in <LF>, as a concession to
non-conforming behavior on the part of some UNIX systems, has proven non-conforming behavior on the part of some UNIX systems, has proven
to cause more interoperability problems than it solves, and SMTP to cause more interoperability problems than it solves, and SMTP
server systems MUST NOT do this, even in the name of improved server systems MUST NOT do this, even in the name of improved
robustness. In particular, the sequence "<LF>.<LF>" (bare line robustness. In particular, the sequence "<LF>.<LF>" (bare line
feeds, without carriage returns) MUST NOT be treated as equivalent to feeds, without carriage returns) MUST NOT be treated as equivalent to
<CRLF>.<CRLF> as the end of mail data indication. <CRLF>.<CRLF> as the end of mail data indication.
Receipt of the end of mail data indication requires the server to Receipt of the end of mail data indication requires the server to
process the stored mail transaction information. This processing process the stored mail transaction information. This processing
consumes the information in the reverse-path buffer, the forward-path consumes the information in the reverse-path buffer, the forward-path
buffer, and the mail data buffer, and on the completion of this buffer, and the mail data buffer, and on the completion of this
command these buffers are cleared. If the processing is successful, command these buffers are cleared. If the processing is successful,
the receiver MUST send an OK reply. If the processing fails, the the receiver MUST send an OK reply. If the processing fails, the
receiver MUST send a failure reply. The SMTP model does not allow receiver MUST send a failure reply. The SMTP model does not allow
for partial failures at this point: either the message is accepted by for partial failures at this point: either the message is accepted by
the server for delivery and a positive response is returned or it is the server for delivery and a positive response is returned or it is
not accepted and a failure reply is returned. In sending a positive not accepted and a failure reply is returned. In sending a positive
"250 OK" [[CREF94: [2821]Tony 20080212#3]] completion reply to the "250 OK" completion reply to the end of data indication, the receiver
end of data indication, the receiver takes full responsibility for takes full responsibility for the message (see Section 6.1). Errors
the message (see Section 6.1). Errors that are diagnosed that are diagnosed subsequently MUST be reported in a mail message,
subsequently MUST be reported in a mail message, as discussed in as discussed in Section 4.4.
Section 4.4.
When the SMTP server accepts a message either for relaying or for When the SMTP server accepts a message either for relaying or for
final delivery, it inserts a trace record (also referred to final delivery, it inserts a trace record (also referred to
interchangeably as a "time stamp line" or "Received" line) at the top interchangeably as a "time stamp line" or "Received" line) at the top
of the mail data. This trace record indicates the identity of the of the mail data. This trace record indicates the identity of the
host that sent the message, the identity of the host that received host that sent the message, the identity of the host that received
the message (and is inserting this time stamp), and the date and time the message (and is inserting this time stamp), and the date and time
the message was received. Relayed messages will have multiple time the message was received. Relayed messages will have multiple time
stamp lines. Details for formation of these lines, including their stamp lines. Details for formation of these lines, including their
syntax, is specified in Section 4.4. syntax, is specified in Section 4.4.
Additional discussion about the operation of the DATA command appears Additional discussion about the operation of the DATA command appears
in Section 3.3. in Section 3.3.
Syntax: Syntax:
data = "DATA" CRLF data = "DATA" CRLF
[[CREF95: [2821]20080222 Tony Hansen -- add production token]]
4.1.1.5. RESET (RSET) 4.1.1.5. RESET (RSET)
This command specifies that the current mail transaction will be This command specifies that the current mail transaction will be
aborted. Any stored sender, recipients, and mail data MUST be aborted. Any stored sender, recipients, and mail data MUST be
discarded, and all buffers and state tables cleared. The receiver discarded, and all buffers and state tables cleared. The receiver
MUST send a "250 OK" reply to a RSET command with no arguments. A MUST send a "250 OK" reply to a RSET command with no arguments. A
reset command may be issued by the client at any time. It is reset command may be issued by the client at any time. It is
effectively equivalent to a NOOP (i.e., it has no effect) if issued effectively equivalent to a NOOP (i.e., it has no effect) if issued
immediately after EHLO, before EHLO is issued in the session, after immediately after EHLO, before EHLO is issued in the session, after
an end of data indicator has been sent and acknowledged, or an end of data indicator has been sent and acknowledged, or
skipping to change at page 41, line 32 skipping to change at page 39, line 8
server, RSET will normally be more efficient than reissuing that server, RSET will normally be more efficient than reissuing that
command, even though the formal semantics are the same. command, even though the formal semantics are the same.
There are circumstances, contrary to the intent of this There are circumstances, contrary to the intent of this
specification, in which an SMTP server may receive an indication that specification, in which an SMTP server may receive an indication that
the underlying TCP connection has been closed or reset. To preserve the underlying TCP connection has been closed or reset. To preserve
the robustness of the mail system, SMTP servers SHOULD be prepared the robustness of the mail system, SMTP servers SHOULD be prepared
for this condition and SHOULD treat it as if a QUIT had been received for this condition and SHOULD treat it as if a QUIT had been received
before the connection disappeared. before the connection disappeared.
Syntax: [[CREF96: [2821]20080222 Tony Hansen -- add production Syntax:
token]]
rset = "RSET" CRLF rset = "RSET" CRLF
4.1.1.6. VERIFY (VRFY) 4.1.1.6. VERIFY (VRFY)
This command asks the receiver to confirm that the argument This command asks the receiver to confirm that the argument
identifies a user or mailbox. If it is a user name, information is identifies a user or mailbox. If it is a user name, information is
returned as specified in Section 3.5. returned as specified in Section 3.5.
This command has no effect on the reverse-path buffer, the forward- This command has no effect on the reverse-path buffer, the forward-
path buffer, or the mail data buffer. path buffer, or the mail data buffer.
Syntax: Syntax:
vrfy = "VRFY" SP String CRLF [[CREF97: [2821]20080222 Tony Hansen vrfy = "VRFY" SP String CRLF
-- add production token]]
4.1.1.7. EXPAND (EXPN) 4.1.1.7. EXPAND (EXPN)
This command asks the receiver to confirm that the argument This command asks the receiver to confirm that the argument
identifies a mailing list, and if so, to return the membership of identifies a mailing list, and if so, to return the membership of
that list. If the command is successful, a reply is returned that list. If the command is successful, a reply is returned
containing information as described in Section 3.5. This reply will containing information as described in Section 3.5. This reply will
have multiple lines except in the trivial case of a one-member list. have multiple lines except in the trivial case of a one-member list.
This command has no effect on the reverse-path buffer, the forward- This command has no effect on the reverse-path buffer, the forward-
path buffer, or the mail data buffer, and it may be issued at any path buffer, or the mail data buffer, and it may be issued at any
time. time.
Syntax: Syntax:
expn = "EXPN" SP String CRLF [[CREF98: [2821]20080222 Tony Hansen expn = "EXPN" SP String CRLF
-- add production token]]
4.1.1.8. HELP (HELP) 4.1.1.8. HELP (HELP)
This command causes the server to send helpful information to the This command causes the server to send helpful information to the
client. The command MAY take an argument (e.g., any command name) client. The command MAY take an argument (e.g., any command name)
and return more specific information as a response. and return more specific information as a response.
This command has no effect on the reverse-path buffer, the forward- This command has no effect on the reverse-path buffer, the forward-
path buffer, or the mail data buffer, and it may be issued at any path buffer, or the mail data buffer, and it may be issued at any
time. time.
SMTP servers SHOULD support HELP without arguments and MAY support it SMTP servers SHOULD support HELP without arguments and MAY support it
with arguments. with arguments.
Syntax: Syntax:
help = "HELP" [ SP String ] CRLF [[CREF99: [2821]20080222 Tony help = "HELP" [ SP String ] CRLF
Hansen -- add production token]]
4.1.1.9. NOOP (NOOP) 4.1.1.9. NOOP (NOOP)
This command does not affect any parameters or previously entered This command does not affect any parameters or previously entered
commands. It specifies no action other than that the receiver send a commands. It specifies no action other than that the receiver send a
"250 OK" [[CREF100: [2821]Tony 20080212#3]] reply. "250 OK" reply.
This command has no effect on the reverse-path buffer, the forward- This command has no effect on the reverse-path buffer, the forward-
path buffer, or the mail data buffer, and it may be issued at any path buffer, or the mail data buffer, and it may be issued at any
time. If a parameter string is specified, servers SHOULD ignore it. time. If a parameter string is specified, servers SHOULD ignore it.
Syntax: Syntax:
noop = "NOOP" [ SP String ] CRLF [[CREF101: [2821]20080222 Tony noop = "NOOP" [ SP String ] CRLF
Hansen -- add production token]]
4.1.1.10. QUIT (QUIT) 4.1.1.10. QUIT (QUIT)
This command specifies that the receiver MUST send a "221 OK" This command specifies that the receiver MUST send a "221 OK" reply,
[[CREF102: [2821]Tony 20080212#3, correction 20080214 13:14]] reply,
and then close the transmission channel. and then close the transmission channel.
The receiver MUST NOT intentionally close the transmission channel The receiver MUST NOT intentionally close the transmission channel
until it receives and replies to a QUIT command (even if there was an until it receives and replies to a QUIT command (even if there was an
error). The sender MUST NOT intentionally close the transmission error). The sender MUST NOT intentionally close the transmission
channel until it sends a QUIT command, and it SHOULD wait until it channel until it sends a QUIT command, and it SHOULD wait until it
receives the reply (even if there was an error response to a previous receives the reply (even if there was an error response to a previous
command). If the connection is closed prematurely due to violations command). If the connection is closed prematurely due to violations
of the above or system or network failure, the server MUST cancel any of the above or system or network failure, the server MUST cancel any
pending transaction, but not undo any previously completed pending transaction, but not undo any previously completed
transaction, and generally MUST act as if the command or transaction transaction, and generally MUST act as if the command or transaction
in progress had received a temporary error (i.e., a 4yz response). in progress had received a temporary error (i.e., a 4yz response).
The QUIT command may be issued at any time. Any current uncompleted The QUIT command may be issued at any time. Any current uncompleted
mail transaction will be aborted. [[CREF103: [2821]Tony mail transaction will be aborted.
20081213#26]]
Syntax: Syntax:
quit = "QUIT" CRLF [[CREF104: [2821]20080222 Tony Hansen -- add quit = "QUIT" CRLF
production token]]
4.1.1.11. Mail-Parameter and Rcpt-Parameter Error Responses 4.1.1.11. Mail-Parameter and Rcpt-Parameter Error Responses
[[CREF105: [2821]Tony 20080212 #6]] If the server SMTP does not If the server SMTP does not recognize or cannot implement one or more
recognize or cannot implement one or more of the parameters of the parameters associated with a particular MAIL FROM or RCPT TO
associated with a particular MAIL FROM or RCPT TO command, it will command, it will return code 555.
return code 555.
If, for some reason, the server is temporarily unable to accommodate If, for some reason, the server is temporarily unable to accommodate
one or more of the parameters associated with a MAIL FROM or RCPT TO one or more of the parameters associated with a MAIL FROM or RCPT TO
command, and if the definition of the specific parameter does not command, and if the definition of the specific parameter does not
mandate the use of another code, it should return code 455. mandate the use of another code, it should return code 455.
Errors specific to particular parameters and their values will be Errors specific to particular parameters and their values will be
specified in the parameter's defining RFC. specified in the parameter's defining RFC.
4.1.2. Command Argument Syntax 4.1.2. Command Argument Syntax
The syntax of the argument clauses of the above commands (using the The syntax of the argument clauses of the above commands (using the
syntax specified in RFC 5234 [5] where applicable) is given below. syntax specified in RFC 5234 [5] where applicable) is given below.
Some of the productions given below are used only in conjunction with Some of the productions given below are used only in conjunction with
source routes as described in Appendix C. Terminals not defined in source routes as described in Appendix C. Terminals not defined in
this document, such as ALPHA, DIGIT, SP, CR, LF, CRLF, are as defined this document, such as ALPHA, DIGIT, SP, CR, LF, CRLF, are as defined
in the "core" syntax in Appendix B of RFC 5234 [5] or in the message in the "core" syntax in Appendix B of RFC 5234 [5] or in the message
format syntax in RFC 5322 [11]. format syntax in RFC 5322 [11].
Reverse-path = Path / "<>" [[CREF106: [2821]20050619 Per Bruce Reverse-path = Path / "<>"
Lilly, 20050228, to move the empty construction here.
Note that this fix is a bit different from the one he
suggested which would have removed "path" from the
reverse path construction.]]
Forward-path = Path Forward-path = Path
Path = "<" [ A-d-l ":" ] Mailbox ">" Path = "<" [ A-d-l ":" ] Mailbox ">"
A-d-l = At-domain *( "," At-domain ) A-d-l = At-domain *( "," At-domain )
; Note that this form, the so-called "source ; Note that this form, the so-called "source
; route", MUST BE accepted, SHOULD NOT be ; route", MUST BE accepted, SHOULD NOT be
; generated, and SHOULD be ignored. [[CREF107: ; generated, and SHOULD be ignored.
[2821]Tony 20080213 #23]]
At-domain = "@" Domain At-domain = "@" Domain
Mail-parameters = esmtp-param *(SP esmtp-param) Mail-parameters = esmtp-param *(SP esmtp-param)
Rcpt-parameters = esmtp-param *(SP esmtp-param) Rcpt-parameters = esmtp-param *(SP esmtp-param)
esmtp-param = esmtp-keyword ["=" esmtp-value] esmtp-param = esmtp-keyword ["=" esmtp-value]
esmtp-keyword = (ALPHA / DIGIT) *(ALPHA / DIGIT / "-") esmtp-keyword = (ALPHA / DIGIT) *(ALPHA / DIGIT / "-")
esmtp-value = 1*(%d33-60 / %d62-126) esmtp-value = 1*(%d33-60 / %d62-126)
; any CHAR excluding "=", SP, and control ; any CHAR excluding "=", SP, and control
; characters. If this string is an email address, ; characters. If this string is an email address,
; i.e., a Mailbox, then the "xtext" syntax [12] ; i.e., a Mailbox, then the "xtext" syntax [12]
; SHOULD be used. [[CREF108: [2821]20070413: -01 ; SHOULD be used.
Issue 13. Note use of reference here will require
some action if 2821ter is moved to full standard
before 3461 advances]]
Keyword = Ldh-str Keyword = Ldh-str
Argument = Atom Argument = Atom
Domain = sub-domain *("." sub-domain) [[CREF109: [2821]
20050619 Email conversation w/ Frank Ellerman Domain = sub-domain *("." sub-domain)
2004.11.12. Permit trailing period in domain names
(required by DNS spec) and mail to TLDs. ( ( sub-
domain 1*("." sub-domain) ["."] ) / sub-domain "." )
Change pulled back out per messages from Ned Freed and
Yuri Inglikov 20060422]] [[CREF110: [2821]Syntax
simplified Tony 20080213 #23]]
sub-domain = Let-dig [Ldh-str] sub-domain = Let-dig [Ldh-str]
Let-dig = ALPHA / DIGIT Let-dig = ALPHA / DIGIT
Ldh-str = *( ALPHA / DIGIT / "-" ) Let-dig Ldh-str = *( ALPHA / DIGIT / "-" ) Let-dig
address-literal = "[" ( IPv4-address-literal / address-literal = "[" ( IPv4-address-literal /
IPv6-address-literal / IPv6-address-literal /
General-address-literal ) "]" General-address-literal ) "]"
skipping to change at page 45, line 33 skipping to change at page 42, line 33
Mailbox = Local-part "@" ( Domain / address-literal ) Mailbox = Local-part "@" ( Domain / address-literal )
Local-part = Dot-string / Quoted-string Local-part = Dot-string / Quoted-string
; MAY be case-sensitive ; MAY be case-sensitive
Dot-string = Atom *("." Atom) Dot-string = Atom *("." Atom)
Atom = 1*atext Atom = 1*atext
Quoted-string = DQUOTE 1*QcontentSMTP DQUOTE [[CREF111: [2821] Quoted-string = DQUOTE 1*QcontentSMTP DQUOTE
...SMTP constructions added per email 20080104, Tony
20080213 #7a]]
QcontentSMTP = qtextSMTP / quoted-pairSMTP QcontentSMTP = qtextSMTP / quoted-pairSMTP
quoted-pairSMTP = %d92 %d32-126 quoted-pairSMTP = %d92 %d32-126
; i.e., backslash followed by any ASCII ; i.e., backslash followed by any ASCII
; graphic (including itself) or SPace ; graphic (including itself) or SPace
qtextSMTP = %d32-33 / %d35-91 / %d93-126 qtextSMTP = %d32-33 / %d35-91 / %d93-126
; i.e., within a quoted string, any ; i.e., within a quoted string, any
; ASCII graphic or space is permitted ; ASCII graphic or space is permitted
skipping to change at page 46, line 49 skipping to change at page 43, line 47
communication (and, in particular, communication to report and repair communication (and, in particular, communication to report and repair
the error) is blocked. To bypass this barrier, a special literal the error) is blocked. To bypass this barrier, a special literal
form of the address is allowed as an alternative to a domain name. form of the address is allowed as an alternative to a domain name.
For IPv4 addresses, this form uses four small decimal integers For IPv4 addresses, this form uses four small decimal integers
separated by dots and enclosed by brackets such as [123.255.37.2], separated by dots and enclosed by brackets such as [123.255.37.2],
which indicates an (IPv4) Internet Address in sequence-of-octets which indicates an (IPv4) Internet Address in sequence-of-octets
form. For IPv6 and other forms of addressing that might eventually form. For IPv6 and other forms of addressing that might eventually
be standardized, the form consists of a standardized "tag" that be standardized, the form consists of a standardized "tag" that
identifies the address syntax, a colon, and the address itself, in a identifies the address syntax, a colon, and the address itself, in a
format specified as part of the relevant standards (i.e., RFC 4291 format specified as part of the relevant standards (i.e., RFC 4291
[6] for IPv6). [[CREF112: [2821]changed from RFC 2373, 20050706; [6] for IPv6).
changed from 3515, 20070301]] [[CREF10: [5321bis] Proposed erratum 4315 (2015-03-27) suggests yet
[[CREF113: [5321bis] Proposed erratum 4315 (2015-03-27) suggests yet
another modification to the IPv6 address literal syntax, based on another modification to the IPv6 address literal syntax, based on
part on RFC 5952. We should consider whether those, or other, part on RFC 5952. We should consider whether those, or other,
modifications are appropriate and/or whether, given both the issues modifications are appropriate and/or whether, given both the issues
of spam/malware and servers supporting multiple domains, it it time of spam/malware and servers supporting multiple domains, it it time
to deprecate mailboxes containing address literals entirely (EHLO to deprecate mailboxes containing address literals entirely (EHLO
fields may be a different issue). If we are going to allow IPv6 fields may be a different issue). If we are going to allow IPv6
address literals, it may be time to incorporate something by address literals, it may be time to incorporate something by
reference rather than including specific syntax here (RFC 5952 is 14 reference rather than including specific syntax here (RFC 5952 is 14
pages long and does not contain any ABNF).]] pages long and does not contain any ABNF).]]
skipping to change at page 47, line 27 skipping to change at page 44, line 22
IPv4-address-literal = Snum 3("." Snum) IPv4-address-literal = Snum 3("." Snum)
IPv6-address-literal = "IPv6:" IPv6-addr IPv6-address-literal = "IPv6:" IPv6-addr
General-address-literal = Standardized-tag ":" 1*dcontent General-address-literal = Standardized-tag ":" 1*dcontent
Standardized-tag = Ldh-str Standardized-tag = Ldh-str
; Standardized-tag MUST be specified in a ; Standardized-tag MUST be specified in a
; Standards-Track RFC and registered with IANA ; Standards-Track RFC and registered with IANA
[[CREF114: [2821]reverted to 2821 form 20080707]]
dcontent = %d33-90 / ; Printable US-ASCII dcontent = %d33-90 / ; Printable US-ASCII
%d94-126 ; excl. "[", "\", "]" %d94-126 ; excl. "[", "\", "]"
Snum = 1*3DIGIT Snum = 1*3DIGIT
; representing a decimal integer ; representing a decimal integer
; value in the range 0 through 255 ; value in the range 0 through 255
IPv6-addr = 6( h16 ":" ) ls32 IPv6-addr = 6( h16 ":" ) ls32
/ "::" 5( h16 ":" ) ls32 / "::" 5( h16 ":" ) ls32
skipping to change at page 48, line 4 skipping to change at page 44, line 47
/ [ *5( h16 ":" ) h16 ] "::" h16 / [ *5( h16 ":" ) h16 ] "::" h16
/ [ *6( h16 ":" ) h16 ] "::" / [ *6( h16 ":" ) h16 ] "::"
; This definition is consistent with the one for ; This definition is consistent with the one for
; URIs [47]. ; URIs [47].
ls32 = ( h16 ":" h16 ) / IPv4address ls32 = ( h16 ":" h16 ) / IPv4address
; least-significant 32 bits of address ; least-significant 32 bits of address
h16 = 1*4HEXDIG h16 = 1*4HEXDIG
; 16 bits of address represented in hexadecimal ; 16 bits of address represented in hexadecimal
[[CREF11: [5321bis](2821ter) 2821bis Last Call
[[CREF115: [5321bis](2821ter) 2821bis Last Call
comment]] comment]]
4.1.4. Order of Commands 4.1.4. Order of Commands
There are restrictions on the order in which these commands may be There are restrictions on the order in which these commands may be
used. used.
A session that will contain mail transactions MUST first be A session that will contain mail transactions MUST first be
initialized by the use of the EHLO command. An SMTP server SHOULD initialized by the use of the EHLO command. An SMTP server SHOULD
accept commands for non-mail transactions (e.g., VRFY or EXPN) accept commands for non-mail transactions (e.g., VRFY or EXPN)
without this initialization. without this initialization.
An EHLO command MAY be issued by a client later in the session. If An EHLO command MAY be issued by a client later in the session. If
it is issued after the session begins and the EHLO command is it is issued after the session begins and the EHLO command is
acceptable to the SMTP server, [[CREF116: [2821]Tony 20080213#25]] acceptable to the SMTP server, the SMTP server MUST clear all buffers
the SMTP server MUST clear all buffers and reset the state exactly as and reset the state exactly as if a RSET command had been issued. In
if a RSET command had been issued. In other words, the sequence of other words, the sequence of RSET followed immediately by EHLO is
RSET followed immediately by EHLO is redundant, but not harmful other redundant, but not harmful other than in the performance cost of
than in the performance cost of executing unnecessary commands. executing unnecessary commands.
If the EHLO command is not acceptable to the SMTP server, 501, 500, If the EHLO command is not acceptable to the SMTP server, 501, 500,
502, or 550 failure replies MUST be returned as appropriate. The 502, or 550 failure replies MUST be returned as appropriate. The
SMTP server MUST stay in the same state after transmitting these SMTP server MUST stay in the same state after transmitting these
replies that it was in before the EHLO was received. replies that it was in before the EHLO was received.
The SMTP client MUST, if possible, ensure that the domain parameter The SMTP client MUST, if possible, ensure that the domain parameter
to the EHLO command is a primary host name as specified for this to the EHLO command is a primary host name as specified for this
command in Section 2.3.5. [[CREF117: [2821] Note to SM, command in Section 2.3.5. If this is not possible (e.g., when the
sm@resistor.net, 20070329, -01 issue 3]] If this is not possible client's address is dynamically assigned and the client does not have
(e.g., when the client's address is dynamically assigned and the an obvious name), an address literal SHOULD be substituted for the
client does not have an obvious name), an address literal SHOULD be domain name.
substituted for the domain name. [[CREF118: [2821]Tony 20080214]]
An SMTP server MAY verify that the domain name argument [[CREF119: An SMTP server MAY verify that the domain name argument in the EHLO
[2821]20050619 Eric Hall, 20020818. Eric wants to go further, command actually corresponds to the IP address of the client.
binding this to reasons for rejection in section 7 (Security [[CREF12: [5321bis] [[Note in draft -- proposed change to "An SMTP
Considerations). Ask WG ???/]] in the EHLO command actually server MAY verify that the domain name argument in the EHLO command
corresponds to the IP address of the client. [[CREF120: [5321bis] has an address record matching the IP address of the client." --David
[[Note in draft -- proposed change to "An SMTP server MAY verify that MacQuigg, david_macquigg@yahoo.com, Friday, 20090130 0637 -0700]]]]
the domain name argument in the EHLO command has an address record However, if the verification fails, the server MUST NOT refuse to
matching the IP address of the client." --David MacQuigg, accept a message on that basis. Information captured in the
david_macquigg@yahoo.com, Friday, 20090130 0637 -0700]]]] However, if verification attempt is for logging and tracing purposes. Note that
the verification fails, the server MUST NOT refuse to accept a this prohibition applies to the matching of the parameter to its IP
message on that basis. Information captured in the verification
attempt is for logging and tracing purposes. Note that this
prohibition applies to the matching of the parameter to its IP
address only; see Section 7.9 for a more extensive discussion of address only; see Section 7.9 for a more extensive discussion of
rejecting incoming connections or mail messages. rejecting incoming connections or mail messages.
The NOOP, HELP, EXPN, VRFY, and RSET commands can be used at any time The NOOP, HELP, EXPN, VRFY, and RSET commands can be used at any time
during a session, or without previously initializing a session. SMTP during a session, or without previously initializing a session. SMTP
servers SHOULD process these normally (that is, not return a 503 servers SHOULD process these normally (that is, not return a 503
code) even if no EHLO command has yet been received; clients SHOULD code) even if no EHLO command has yet been received; clients SHOULD
open a session with EHLO before sending these commands. open a session with EHLO before sending these commands.
If these rules are followed, the example in RFC 821 that shows "550 If these rules are followed, the example in RFC 821 that shows "550
skipping to change at page 49, line 26 skipping to change at page 46, line 18
based on the client's IP address or other authentication or based on the client's IP address or other authentication or
authorization-determining mechanisms. authorization-determining mechanisms.
The MAIL command (or the obsolete SEND, SOML, or SAML commands) The MAIL command (or the obsolete SEND, SOML, or SAML commands)
[[5321bis Editor's Note: is there any reason to not clean those [[5321bis Editor's Note: is there any reason to not clean those
commands out of this entirely, replacing them with, e.g., a strong commands out of this entirely, replacing them with, e.g., a strong
reference to Appendix F.6]] reference to Appendix F.6]]
begins a mail transaction. Once started, a mail transaction consists begins a mail transaction. Once started, a mail transaction consists
of a transaction beginning command, one or more RCPT commands, and a of a transaction beginning command, one or more RCPT commands, and a
DATA command, in that order. A mail transaction may be aborted by DATA command, in that order. A mail transaction may be aborted by
the RSET, a new EHLO, or the QUIT command. [[CREF121: [2821]Tony the RSET, a new EHLO, or the QUIT command. There may be zero or more
20080213#26]] There may be zero or more transactions in a session. transactions in a session. MAIL (or SEND, SOML, or SAML) MUST NOT be
MAIL (or SEND, SOML, or SAML) MUST NOT be sent if a mail transaction sent if a mail transaction is already open, i.e., it should be sent
is already open, i.e., it should be sent only if no mail transaction only if no mail transaction had been started in the session, or if
had been started in the session, or if the previous one successfully the previous one successfully concluded with a successful DATA
concluded with a successful DATA command, or if the previous one was command, or if the previous one was aborted, e.g., with a RSET or new
aborted, e.g., with a RSET or new EHLO.[[CREF122: [2821]Tony EHLO. [[CREF13: [5321bis] 2821ter note: see comment about changing
20080320]] [[CREF123: [5321bis] 2821ter note: see comment about this convoluted discussion to talk about 'mail transaction' above.
changing this convoluted discussion to talk about 'mail transaction' --Jck]]
above. --Jck]]
If the transaction beginning command argument is not acceptable, a If the transaction beginning command argument is not acceptable, a
501 failure reply MUST be returned and the SMTP server MUST stay in 501 failure reply MUST be returned and the SMTP server MUST stay in
the same state. If the commands in a transaction are out of order to the same state. If the commands in a transaction are out of order to
the degree that they cannot be processed by the server, a 503 failure the degree that they cannot be processed by the server, a 503 failure
reply MUST be returned and the SMTP server MUST stay in the same reply MUST be returned and the SMTP server MUST stay in the same
state. state.
The last command in a session MUST be the QUIT command. The QUIT The last command in a session MUST be the QUIT command. The QUIT
command SHOULD [[CREF124: [2821]Tony 20080213#27]] be used by the command SHOULD be used by the client SMTP to request connection
client SMTP to request connection closure, even when no session closure, even when no session opening command was sent and accepted.
opening command was sent and accepted.
4.1.5. Private-Use Commands 4.1.5. Private-Use Commands
As specified in Section 2.2.2, commands starting in "X" may be used As specified in Section 2.2.2, commands starting in "X" may be used
by bilateral agreement between the client (sending) and server by bilateral agreement between the client (sending) and server
(receiving) SMTP agents. An SMTP server that does not recognize such (receiving) SMTP agents. An SMTP server that does not recognize such
a command is expected to reply with "500 Command not recognized". An a command is expected to reply with "500 Command not recognized". An
extended SMTP server MAY list the feature names associated with these extended SMTP server MAY list the feature names associated with these
private commands in the response to the EHLO command. private commands in the response to the EHLO command.
skipping to change at page 51, line 7 skipping to change at page 47, line 44
circumstances; however, multiline replies are allowed for any circumstances; however, multiline replies are allowed for any
command. command.
In ABNF, server responses are: In ABNF, server responses are:
Greeting = ( "220 " (Domain / address-literal) Greeting = ( "220 " (Domain / address-literal)
[ SP textstring ] CRLF ) / [ SP textstring ] CRLF ) /
( "220-" (Domain / address-literal) ( "220-" (Domain / address-literal)
[ SP textstring ] CRLF [ SP textstring ] CRLF
*( "220-" [ textstring ] CRLF ) *( "220-" [ textstring ] CRLF )
"220" [ SP textstring ] CRLF ) [[CREF125: [2821]Tony "220" [ SP textstring ] CRLF )
Finch 20050415, Issue 15, continuation of Greeting]]
[[CREF126: [2821]Changed 'text' to 'textstring' and
added production for the latter, JcK 20080504]]
textstring = 1*(%d09 / %d32-126) ; HT, SP, Printable US-ASCII textstring = 1*(%d09 / %d32-126) ; HT, SP, Printable US-ASCII
Reply-line = *( Reply-code "-" [ textstring ] CRLF ) Reply-line = *( Reply-code "-" [ textstring ] CRLF )
Reply-code [ SP textstring ] CRLF [[CREF127: Reply-code [ SP textstring ] CRLF
[2821]Tony Finch 20050405, Issue 15, allow for
continuation and add production for Reply-code]]
Reply-code = %x32-35 %x30-35 %x30-39 [[CREF128: [2821]??? Frank
Ellerman suggests inserting changing "text" above to
"Reply-text" and inserting something like Reply-text =
1*VCHAR *( 1*WSP 1*VCHAR ) here. 20070405, but need
to define VCHAR if going to do so.]] [[CREF129:
[2821]Reply-code changed to %32... from %31... as
part of 1yz removal, JcK 20070424]]
Reply-code = %x32-35 %x30-35 %x30-39
where "Greeting" appears only in the 220 response that announces that where "Greeting" appears only in the 220 response that announces that
the server is opening its part of the connection. [[CREF130: [2821] the server is opening its part of the connection. (Other possible
20050619 Note that the "Domain" change prohibits an address literal server responses upon connection follow the syntax of Reply-line.)
here. That seems reasonable since the host must know its domain
name(s) to handle MXs properly. ]] (Other possible server responses
upon connection follow the syntax of Reply-line.) [[CREF131:
[2821]Tony, 20080320]]
An SMTP server SHOULD send only the reply codes listed in this An SMTP server SHOULD send only the reply codes listed in this
document or additions to the list as discussed below. document or additions to the list as discussed below.
[[CREF132: [5321bis] 20140804: New text to clear up ambiguity.]] [[CREF14: [5321bis] 20140804: New text to clear up ambiguity.]]
An SMTP server SHOULD use the text shown in the examples whenever An SMTP server SHOULD use the text shown in the examples whenever
appropriate. appropriate.
An SMTP client MUST determine its actions only by the reply code, not An SMTP client MUST determine its actions only by the reply code, not
by the text (except for the "change of address" 251 and 551 and, if by the text (except for the "change of address" 251 and 551 and, if
necessary, 220, 221, and 421 replies); in the general case, any text, necessary, 220, 221, and 421 replies); in the general case, any text,
including no text at all (although senders SHOULD NOT send bare including no text at all (although senders SHOULD NOT send bare
codes), MUST be acceptable. The space (blank) following the reply codes), MUST be acceptable. The space (blank) following the reply
code is considered part of the text. Whenever possible, a sender- code is considered part of the text. Whenever possible, a sender-
SMTP SHOULD test the first digit (severity indication) of a reply SMTP SHOULD test the first digit (severity indication) of a reply
code it receives. code it receives.
[[CREF133: [5321bis] 20141209 [[Note in Draft: What is that sentence [[CREF15: [5321bis] 20141209 [[Note in Draft: What is that sentence
supposed to be tell us? Test the first digit and examine the others supposed to be tell us? Test the first digit and examine the others
only if necessary? Note the interaction between this and various only if necessary? Note the interaction between this and various
flaps about adding new codes.]]]] flaps about adding new codes.]]]]
The list of codes that appears below MUST NOT be construed as The list of codes that appears below MUST NOT be construed as
permanent. While the addition of new codes should be a rare and permanent. While the addition of new codes should be a rare and
significant activity, with supplemental information in the textual significant activity, with supplemental information in the textual
part of the response (including enhanced status codes [38] and the part of the response (including enhanced status codes [38] and the
successors to that specification) successors to that specification)
[[CREF134: [5321bis] 20140802: New text for clarity]] [[CREF16: [5321bis] 20140802: New text for clarity]]
being preferred, new codes may be added as the result of new being preferred, new codes may be added as the result of new
Standards or Standards-Track specifications. Consequently, a sender- Standards or Standards-Track specifications. Consequently, a sender-
SMTP MUST be prepared to handle codes not specified in this document SMTP MUST be prepared to handle codes not specified in this document
and MUST do so by interpreting the first digit only. and MUST do so by interpreting the first digit only.
In the absence of extensions negotiated with the client, SMTP servers In the absence of extensions negotiated with the client, SMTP servers
MUST NOT send reply codes whose first digits are other than 2, 3, 4, MUST NOT send reply codes whose first digits are other than 2, 3, 4,
or 5. Clients that receive such out-of-range codes SHOULD normally or 5. Clients that receive such out-of-range codes SHOULD normally
treat them as fatal errors and terminate the mail transaction. treat them as fatal errors and terminate the mail transaction.
skipping to change at page 52, line 36 skipping to change at page 49, line 8
first digit denotes whether the response is good, bad, or incomplete. first digit denotes whether the response is good, bad, or incomplete.
An unsophisticated SMTP client, or one that receives an unexpected An unsophisticated SMTP client, or one that receives an unexpected
code, will be able to determine its next action (proceed as planned, code, will be able to determine its next action (proceed as planned,
redo, retrench, etc.) by examining this first digit. An SMTP client redo, retrench, etc.) by examining this first digit. An SMTP client
that wants to know approximately what kind of error occurred (e.g., that wants to know approximately what kind of error occurred (e.g.,
mail system error, command syntax error) may examine the second mail system error, command syntax error) may examine the second
digit. The third digit and any supplemental information that may be digit. The third digit and any supplemental information that may be
present is reserved for the finest gradation of information. present is reserved for the finest gradation of information.
There are four values for the first digit of the reply code: There are four values for the first digit of the reply code:
[[CREF135: [2821]1yz discussion eliminated and replaced with a
pointer to FTP. See comment and new text after list - seems to be
list consensus, JcK 20070424]]
2yz Positive Completion reply 2yz Positive Completion reply
The requested action has been successfully completed. A new The requested action has been successfully completed. A new
request may be initiated. request may be initiated.
3yz Positive Intermediate reply 3yz Positive Intermediate reply
The command has been accepted, but the requested action is being The command has been accepted, but the requested action is being
held in abeyance, pending receipt of further information. The held in abeyance, pending receipt of further information. The
SMTP client should send another command specifying this SMTP client should send another command specifying this
information. This reply is used in command sequence groups (i.e., information. This reply is used in command sequence groups (i.e.,
in DATA). in DATA).
4yz Transient Negative Completion reply 4yz Transient Negative Completion reply
The command was not accepted, and the requested action did not The command was not accepted, and the requested action did not
occur. However, the error condition is temporary, and the action occur. However, the error condition is temporary, and the action
may be requested again. The sender should return to the beginning may be requested again. The sender should return to the beginning
of the command sequence (if any). It is difficult to assign a of the command sequence (if any). It is difficult to assign a
meaning to "transient" when two different sites (receiver- and meaning to "transient" when two different sites (receiver- and
sender-SMTP agents) must agree on the interpretation. Each reply sender-SMTP agents) must agree on the interpretation. Each reply
in this category might have a different time value, but the SMTP in this category might have a different time value, but the SMTP
client SHOULD [[CREF136: [2821]Was "is encouraged to". Changed client SHOULD try again. A rule of thumb to determine whether a
per S. Moonesamy <sm@elandsys.com> 20050714 ]] try again. A rule reply fits into the 4yz or the 5yz category (see below) is that
of thumb to determine whether a reply fits into the 4yz or the 5yz replies are 4yz if they can be successful if repeated without any
category (see below) is that replies are 4yz if they can be change in command form or in properties of the sender or receiver
successful if repeated without any change in command form or in (that is, the command is repeated identically and the receiver
properties of the sender or receiver (that is, the command is does not put up a new implementation).
repeated identically and the receiver does not put up a new
implementation).
5yz Permanent Negative Completion reply 5yz Permanent Negative Completion reply
The command was not accepted and the requested action did not The command was not accepted and the requested action did not
occur. The SMTP client SHOULD NOT [[CREF137: [2821]S. Moonesamy occur. The SMTP client SHOULD NOT repeat the exact request (in
<sm@elandsys.com> 20050714 suggests changing to SHOULD NOT. the same sequence). Even some "permanent" error conditions can be
Changed, issue 16, 20070417.]] repeat the exact request (in the
same sequence). Even some "permanent" error conditions can be
corrected, so the human user may want to direct the SMTP client to corrected, so the human user may want to direct the SMTP client to
reinitiate the command sequence by direct action at some point in reinitiate the command sequence by direct action at some point in
the future (e.g., after the spelling has been changed, or the user the future (e.g., after the spelling has been changed, or the user
has altered the account status). has altered the account status).
It is worth noting that the file transfer protocol (FTP) [18] uses a It is worth noting that the file transfer protocol (FTP) [18] uses a
very similar code architecture and that the SMTP codes are based on very similar code architecture and that the SMTP codes are based on
the FTP model. However, SMTP uses a one-command, one-response model the FTP model. However, SMTP uses a one-command, one-response model
(while FTP is asynchronous) and FTP's 1yz codes are not part of the (while FTP is asynchronous) and FTP's 1yz codes are not part of the
SMTP model. [[CREF138: [2821]New text, JcK 20070424, see above.]] SMTP model.
The second digit encodes responses in specific categories: The second digit encodes responses in specific categories:
x0z Syntax: These replies refer to syntax errors, syntactically x0z Syntax: These replies refer to syntax errors, syntactically
correct commands that do not fit any functional category, and correct commands that do not fit any functional category, and
unimplemented or superfluous commands. unimplemented or superfluous commands.
x1z Information: These are replies to requests for information, such x1z Information: These are replies to requests for information, such
as status or help. as status or help.
skipping to change at page 54, line 48 skipping to change at page 51, line 13
For example: For example:
250-First line 250-First line
250-Second line 250-Second line
250-234 Text beginning with numbers 250-234 Text beginning with numbers
250 The last line 250 The last line
In a multiline reply, the reply code on each of the lines MUST be the In a multiline reply, the reply code on each of the lines MUST be the
same. It is reasonable for the client to rely on this, so it can same. It is reasonable for the client to rely on this, so it can
make processing decisions based on the code in any line, assuming make processing decisions based on the code in any line, assuming
that all others will be the same. [[CREF139: [2821] Added after list that all others will be the same. In a few cases, there is important
discussion, 20070413. This is obviously the strongest form of the data for the client in the reply "text". The client will be able to
prohibition/specification and makes the former next sentence about identify these cases from the current context.
the last line useless. Affirmed as consensus, Tony Hansen,
20070423]] In a few cases, there is important data for the client in
the reply "text". The client will be able to identify these cases
from the current context.
4.2.2. Reply Codes by Function Groups 4.2.2. Reply Codes by Function Groups
500 Syntax error, command unrecognized (This may include errors such 500 Syntax error, command unrecognized (This may include errors such
as command line too long) as command line too long)
501 Syntax error in parameters or arguments 501 Syntax error in parameters or arguments
502 Command not implemented (see Section 4.2.4.1) 502 Command not implemented (see Section 4.2.4.1)
skipping to change at page 55, line 34 skipping to change at page 51, line 44
only to the human user) only to the human user)
220 <domain> Service ready 220 <domain> Service ready
221 <domain> Service closing transmission channel 221 <domain> Service closing transmission channel
421 <domain> Service not available, closing transmission channel 421 <domain> Service not available, closing transmission channel
(This may be a reply to any command if the service knows it must (This may be a reply to any command if the service knows it must
shut down) shut down)
hangText="521"><domain> No mail service here. [[CREF140: hangText="521"><domain> No mail service here. [[CREF17:
[5321bis]20140804: Specific code introduced with RFC 1846, updated [5321bis]20140804: Specific code introduced with RFC 1846, updated
and specified in draft-klensin-smtp-521code.]] and specified in draft-klensin-smtp-521code.]]
556 No mail service at this domain. [[CREF141: [5321bis] 20140912: 556 No mail service at this domain. [[CREF18: [5321bis] 20140912:
Specific code introduced in draft-klensin-smtp-521code-02, largely Specific code introduced in draft-klensin-smtp-521code-02, largely
for nullMX]] for nullMX]]
250 Requested mail action okay, completed 250 Requested mail action okay, completed
251 User not local; will forward to <forward-path> (See Section 3.4) 251 User not local; will forward to <forward-path> (See Section 3.4)
252 Cannot VRFY user, but will accept message and attempt delivery 252 Cannot VRFY user, but will accept message and attempt delivery
(See Section 3.5.3) (See Section 3.5.3)
455 Server unable to accommodate parameters [[CREF142: [2821]Tony 455 Server unable to accommodate parameters
20080212#6]]
555 MAIL FROM/RCPT TO parameters not recognized or not implemented 555 MAIL FROM/RCPT TO parameters not recognized or not implemented
[[CREF143: [2821]Tony 20080212#6]]
450 Requested mail action not taken: mailbox unavailable (e.g., 450 Requested mail action not taken: mailbox unavailable (e.g.,
mailbox busy or temporarily blocked for policy reasons)[[CREF144: mailbox busy or temporarily blocked for policy reasons)
[2821]Note from Lisa, 20070426]]
550 Requested action not taken: mailbox unavailable (e.g., mailbox 550 Requested action not taken: mailbox unavailable (e.g., mailbox
not found, no access, or command rejected for policy reasons) not found, no access, or command rejected for policy reasons)
451 Requested action aborted: error in processing 451 Requested action aborted: error in processing
551 User not local; please try <forward-path> (See Section 3.4) 551 User not local; please try <forward-path> (See Section 3.4)
452 Requested action not taken: insufficient system storage 452 Requested action not taken: insufficient system storage
552 Requested mail action aborted: exceeded storage allocation 552 Requested mail action aborted: exceeded storage allocation
553 Requested action not taken: mailbox name not allowed (e.g., 553 Requested action not taken: mailbox name not allowed (e.g.,
mailbox syntax incorrect) mailbox syntax incorrect)
354 Start mail input; end with <CRLF>.<CRLF> 354 Start mail input; end with <CRLF>.<CRLF>
554 Transaction failed (Or, in the case of a connection-opening 554 Transaction failed (Or, in the case of a connection-opening
response, "No SMTP service here") response, "No SMTP service here")
[[CREF145: [5321bis] [[Note in Draft: Revise above statement in [[CREF19: [5321bis] [[Note in Draft: Revise above statement in the
the light of new 521 code??]] ]] light of new 521 code??]] ]]
4.2.3. Reply Codes in Numeric Order 4.2.3. Reply Codes in Numeric Order
211 System status, or system help reply 211 System status, or system help reply
214 Help message (Information on how to use the receiver or the 214 Help message (Information on how to use the receiver or the
meaning of a particular non-standard command; this reply is useful meaning of a particular non-standard command; this reply is useful
only to the human user) only to the human user)
220 <domain> Service ready 220 <domain> Service ready
skipping to change at page 56, line 49 skipping to change at page 53, line 4
214 Help message (Information on how to use the receiver or the 214 Help message (Information on how to use the receiver or the
meaning of a particular non-standard command; this reply is useful meaning of a particular non-standard command; this reply is useful
only to the human user) only to the human user)
220 <domain> Service ready 220 <domain> Service ready
221 <domain> Service closing transmission channel 221 <domain> Service closing transmission channel
250 Requested mail action okay, completed 250 Requested mail action okay, completed
251 User not local; will forward to <forward-path> (See Section 3.4) 251 User not local; will forward to <forward-path> (See Section 3.4)
252 Cannot VRFY user, but will accept message and attempt delivery 252 Cannot VRFY user, but will accept message and attempt delivery
(See Section 3.5.3) (See Section 3.5.3)
354 Start mail input; end with <CRLF>.<CRLF> 354 Start mail input; end with <CRLF>.<CRLF>
421 <domain> Service not available, closing transmission channel 421 <domain> Service not available, closing transmission channel
(This may be a reply to any command if the service knows it must (This may be a reply to any command if the service knows it must
shut down) shut down)
450 Requested mail action not taken: mailbox unavailable (e.g., 450 Requested mail action not taken: mailbox unavailable (e.g.,
mailbox busy or temporarily blocked for policy reasons)[[CREF146: mailbox busy or temporarily blocked for policy reasons)
[2821]Note from Lisa, 20070426]])
451 Requested action aborted: local error in processing 451 Requested action aborted: local error in processing
452 Requested action not taken: insufficient system storage 452 Requested action not taken: insufficient system storage
455 Server unable to accommodate parameters [[CREF147: [2821]Tony 455 Server unable to accommodate parameters
20080212#6]]
500 Syntax error, command unrecognized (This may include errors such 500 Syntax error, command unrecognized (This may include errors such
as command line too long) as command line too long)
501 Syntax error in parameters or arguments 501 Syntax error in parameters or arguments
502 Command not implemented (see Section 4.2.4.1) 502 Command not implemented (see Section 4.2.4.1)
503 Bad sequence of commands 503 Bad sequence of commands
skipping to change at page 58, line 9 skipping to change at page 54, line 9
552 Requested mail action aborted: exceeded storage allocation 552 Requested mail action aborted: exceeded storage allocation
553 Requested action not taken: mailbox name not allowed (e.g., 553 Requested action not taken: mailbox name not allowed (e.g.,
mailbox syntax incorrect) mailbox syntax incorrect)
554 Transaction failed (Or, in the case of a connection-opening 554 Transaction failed (Or, in the case of a connection-opening
response, "No SMTP service here") response, "No SMTP service here")
555 MAIL FROM/RCPT TO parameters not recognized or not implemented 555 MAIL FROM/RCPT TO parameters not recognized or not implemented
[[CREF148: [2821]Tony 20080212#6]]
556 No mail service at this domain. 556 No mail service at this domain.
4.2.4. Some specific code situations and relationships 4.2.4. Some specific code situations and relationships
4.2.4.1. Reply Code 502 4.2.4.1. Reply Code 502
Questions have been raised as to when reply code 502 (Command not Questions have been raised as to when reply code 502 (Command not
implemented) SHOULD be returned in preference to other codes. 502 implemented) SHOULD be returned in preference to other codes. 502
SHOULD be used when the command is actually recognized by the SMTP SHOULD be used when the command is actually recognized by the SMTP
server, but not implemented. If the command is not recognized, code server, but not implemented. If the command is not recognized, code
500 SHOULD be returned. Extended SMTP systems MUST NOT list 500 SHOULD be returned. Extended SMTP systems MUST NOT list
capabilities in response to EHLO for which they will return 502 (or capabilities in response to EHLO for which they will return 502 (or
500) replies. 500) replies.
4.2.4.2. "No mail accepted" situations and the 521, 554, and 556 codes 4.2.4.2. "No mail accepted" situations and the 521, 554, and 556 codes
[[CREF149: [5321bis] This section is new with 5321bis. ]] [[CREF20: [5321bis] This section is new with 5321bis. ]]
Codes 521, 554, and 556 are all used to report different types of "no Codes 521, 554, and 556 are all used to report different types of "no
mail accepted" situations. They differ as follows. 521 is an mail accepted" situations. They differ as follows. 521 is an
indication from a system answering on the SMTP port that it does not indication from a system answering on the SMTP port that it does not
support SMTP service (a so-called "dummy server" as discussed in RFC support SMTP service (a so-called "dummy server" as discussed in RFC
1846 [24] and elsewhere). Obviously, it requires that system exist 1846 [24] and elsewhere). Obviously, it requires that system exist
and that a connection can be made successfully to it. Because a and that a connection can be made successfully to it. Because a
system that does not accept any mail cannot meaningfully accept a system that does not accept any mail cannot meaningfully accept a
RCPT command, any commands (other than QUIT) issued after an SMTP RCPT command, any commands (other than QUIT) issued after an SMTP
server has issued a 521 reply are client (sender) errors. 556 is server has issued a 521 reply are client (sender) errors. 556 is
skipping to change at page 59, line 23 skipping to change at page 55, line 23
o if attempts to deliver the message fail due to transient o if attempts to deliver the message fail due to transient
conditions, retrying delivery some reasonable number of times at conditions, retrying delivery some reasonable number of times at
intervals as specified in Section 4.5.4. intervals as specified in Section 4.5.4.
o if attempts to deliver the message fail due to permanent o if attempts to deliver the message fail due to permanent
conditions, or if repeated attempts to deliver the message fail conditions, or if repeated attempts to deliver the message fail
due to transient conditions, returning appropriate notification to due to transient conditions, returning appropriate notification to
the sender of the original message (using the address in the SMTP the sender of the original message (using the address in the SMTP
MAIL command). MAIL command).
When an SMTP server returns a temporary error status (4yz) [[CREF150: When an SMTP server returns a temporary error status (4yz) code after
[2821] 20050619 Per note from Bryon Roche Kain <kain@kain.org> the DATA command is completed with <CRLF>.<CRLF>, it MUST NOT make a
20011119. Also spotted by Mathias Koerber 20061011.]] code after the
DATA command is completed with <CRLF>.<CRLF>, it MUST NOT make a
subsequent attempt to deliver that message. The SMTP client retains subsequent attempt to deliver that message. The SMTP client retains
responsibility for the delivery of that message and may either return responsibility for the delivery of that message and may either return
it to the user or requeue it for a subsequent attempt (see it to the user or requeue it for a subsequent attempt (see
Section 4.5.4.1). Section 4.5.4.1).
The user who originated the message SHOULD be able to interpret the The user who originated the message SHOULD be able to interpret the
return of a transient failure status (by mail message or otherwise) return of a transient failure status (by mail message or otherwise)
as a non-delivery indication, just as a permanent failure would be as a non-delivery indication, just as a permanent failure would be
interpreted. If the client SMTP successfully handles these interpreted. If the client SMTP successfully handles these
conditions, the user will not receive such a reply. conditions, the user will not receive such a reply.
When an SMTP server returns a permanent error status (5yz) code after When an SMTP server returns a permanent error status (5yz) code after
the DATA command is completed [[CREF151: [2821]20050619 Bruce Lilly, the DATA command is completed with <CRLF>.<CRLF>, it MUST NOT make
20010712]] with <CRLF>.<CRLF>, it MUST NOT make any subsequent any subsequent attempt to deliver the message. As with temporary
attempt to deliver the message. As with temporary error status error status codes, the SMTP client retains responsibility for the
codes, the SMTP client retains responsibility for the message, but message, but SHOULD not again attempt delivery to the same server
SHOULD not again attempt delivery to the same server without user without user review of the message and response and appropriate
review of the message and response and appropriate intervention. intervention.
4.3. Sequencing of Commands and Replies 4.3. Sequencing of Commands and Replies
4.3.1. Sequencing Overview 4.3.1. Sequencing Overview
The communication between the sender and receiver is an alternating The communication between the sender and receiver is an alternating
dialogue, controlled by the sender. As such, the sender issues a dialogue, controlled by the sender. As such, the sender issues a
command and the receiver responds with a reply. Unless other command and the receiver responds with a reply. Unless other
arrangements are negotiated through service extensions, the sender arrangements are negotiated through service extensions, the sender
MUST wait for this response before sending further commands. One MUST wait for this response before sending further commands. One
skipping to change at page 60, line 23 skipping to change at page 56, line 21
word following the reply code. Sometimes the host will have no word following the reply code. Sometimes the host will have no
meaningful name. See Section 4.1.3 for a discussion of alternatives meaningful name. See Section 4.1.3 for a discussion of alternatives
in these situations. in these situations.
For example, For example,
220 ISIF.USC.EDU Service ready 220 ISIF.USC.EDU Service ready
or or
220 mail.example.com SuperSMTP v 6.1.2 Service ready [[CREF152: 220 mail.example.com SuperSMTP v 6.1.2 Service ready
[2821]S. Moonesamy <sm@elandsys.com> 20050714]]
or or
220 [10.0.0.1] Clueless host service ready 220 [10.0.0.1] Clueless host service ready
The table below lists alternative success and failure replies for The table below lists alternative success and failure replies for
each command. These SHOULD be strictly adhered to. A receiver MAY each command. These SHOULD be strictly adhered to. A receiver MAY
substitute text in the replies, but the meanings and actions implied substitute text in the replies, but the meanings and actions implied
by the code numbers and by the specific command reply sequence MUST by the code numbers and by the specific command reply sequence MUST
be preserved. [[CREF153: [2821]Note from SM 20070414]] be preserved. However, in order to provide robustness as SMTP is
However, in order to provide robustness as SMTP is extended and extended and evolves, the discussion in Section 4.2.1 still applies:
evolves, the discussion in Section 4.2.1 still applies: all SMTP all SMTP clients MUST be prepared to accept any code that conforms to
clients MUST be prepared to accept any code that conforms to the the discussion in that section and MUST be prepared to interpret it
discussion in that section and MUST be prepared to interpret it on on the basis of its first digit only. [[CREF21: [5321bis] 20140914:
the basis of its first digit only. [[CREF154: [5321bis] 20140914:
Above sentence is new text based on yet another round of discussions Above sentence is new text based on yet another round of discussions
about "invalid codes".]] about "invalid codes".]]
4.3.2. Command-Reply Sequences 4.3.2. Command-Reply Sequences
Each command is listed with its usual possible replies. The prefixes Each command is listed with its usual possible replies. The prefixes
used before the possible replies are "I" for intermediate, "S" for used before the possible replies are "I" for intermediate, "S" for
success, and "E" for error. Since some servers may generate other success, and "E" for error. Since some servers may generate other
replies under special circumstances, and to allow for future replies under special circumstances, and to allow for future
extension, SMTP clients SHOULD, when possible, interpret only the extension, SMTP clients SHOULD, when possible, interpret only the
skipping to change at page 61, line 4 skipping to change at page 56, line 48
4.3.2. Command-Reply Sequences 4.3.2. Command-Reply Sequences
Each command is listed with its usual possible replies. The prefixes Each command is listed with its usual possible replies. The prefixes
used before the possible replies are "I" for intermediate, "S" for used before the possible replies are "I" for intermediate, "S" for
success, and "E" for error. Since some servers may generate other success, and "E" for error. Since some servers may generate other
replies under special circumstances, and to allow for future replies under special circumstances, and to allow for future
extension, SMTP clients SHOULD, when possible, interpret only the extension, SMTP clients SHOULD, when possible, interpret only the
first digit of the reply and MUST be prepared to deal with first digit of the reply and MUST be prepared to deal with
unrecognized reply codes by interpreting the first digit only. unrecognized reply codes by interpreting the first digit only.
Unless extended using the mechanisms described in Section 2.2, SMTP Unless extended using the mechanisms described in Section 2.2, SMTP
servers MUST NOT transmit reply codes to an SMTP client that are servers MUST NOT transmit reply codes to an SMTP client that are
other than three digits or that do not start in a digit between 2 and other than three digits or that do not start in a digit between 2 and
5 inclusive. 5 inclusive.
These sequencing rules and, in principle, the codes themselves, can These sequencing rules and, in principle, the codes themselves, can
be extended or modified by SMTP extensions offered by the server and be extended or modified by SMTP extensions offered by the server and
accepted (requested) by the client. However, if the target is more accepted (requested) by the client. However, if the target is more
precise granularity in the codes, rather than codes for completely precise granularity in the codes, rather than codes for completely
new purposes, the system described in RFC 3463 [38] SHOULD be used in new purposes, the system described in RFC 3463 [38] SHOULD be used in
preference to the [[CREF155: [2821]Preferred->Should, etc. Issue 16 preference to the invention of new codes.
20070421]] invention of new codes. [[CREF156: [2821] Clarification,
20050706 ]]
In addition to the codes listed below, any SMTP command can return In addition to the codes listed below, any SMTP command can return
any of the following codes if the corresponding unusual circumstances any of the following codes if the corresponding unusual circumstances
are encountered: are encountered:
500 For the "command line too long" case or if the command name was 500 For the "command line too long" case or if the command name was
not recognized. Note that producing a "command not recognized" not recognized. Note that producing a "command not recognized"
error in response to the required subset of these commands is a error in response to the required subset of these commands is a
violation of this specification. Similarly, producing a "command violation of this specification. Similarly, producing a "command
too long" message for a command line shorter than 512 characters too long" message for a command line shorter than 512 characters
would violate the provisions of Section 4.5.3.1.4. [[CREF157: would violate the provisions of Section 4.5.3.1.4.
[2821]Tony 20080212 #2]]
501 Syntax error in command or arguments. In order to provide for 501 Syntax error in command or arguments. In order to provide for
future extensions, commands that are specified in this document as future extensions, commands that are specified in this document as
not accepting arguments (DATA, RSET, QUIT) SHOULD return a 501 not accepting arguments (DATA, RSET, QUIT) SHOULD return a 501
message if arguments are supplied in the absence of EHLO- message if arguments are supplied in the absence of EHLO-
advertised extensions. advertised extensions.
421 Service shutting down and closing transmission channel 421 Service shutting down and closing transmission channel
Specific sequences are: Specific sequences are:
skipping to change at page 62, line 21 skipping to change at page 58, line 12
S: 250, 251 (but see Section 3.4 for discussion of 251 and 551) S: 250, 251 (but see Section 3.4 for discussion of 251 and 551)
E: 550, 551, 552, 553, 450, 451, 452, 503, 455, 555 E: 550, 551, 552, 553, 450, 451, 452, 503, 455, 555
DATA DATA
I: 354 -> data -> S: 250 I: 354 -> data -> S: 250
E: 552, 554, 451, 452 E: 552, 554, 451, 452
E: 450, 550 (rejections for policy reasons) [[CREF158: E: 450, 550 (rejections for policy reasons)
[2821]S. Moonesamy 20050714]]
E: 503, 554[[CREF159: [2821]Tony 20080320]] E: 503, 554
RSET RSET
S: 250 S: 250
VRFY VRFY
S: 250, 251, 252 S: 250, 251, 252
E: 550, 551, 553, 502, 504 E: 550, 551, 553, 502, 504
skipping to change at page 63, line 9 skipping to change at page 58, line 47
S: 250 S: 250
QUIT QUIT
S: 221 S: 221
4.4. Trace Information 4.4. Trace Information
When an SMTP server receives a message for delivery or further When an SMTP server receives a message for delivery or further
processing, it MUST insert trace (often referred to as "time stamp" processing, it MUST insert trace (often referred to as "time stamp"
or "Received" information) [[CREF160: [5321bis] See note on or "Received" information) [[CREF22: [5321bis] See note on
rfc5321bis-00c above]] information at the beginning of the message rfc5321bis-00c above]] information at the beginning of the message
content, as discussed in Section 4.1.1.4. content, as discussed in Section 4.1.1.4.
This line MUST be structured as follows: This line MUST be structured as follows:
o The FROM clause, which MUST be supplied in an SMTP environment, o The FROM clause, which MUST be supplied in an SMTP environment,
SHOULD contain both (1) the name of the source host as presented SHOULD contain both (1) the name of the source host as presented
in the EHLO command and (2) an address literal containing the IP in the EHLO command and (2) an address literal containing the IP
address of the source, determined from the TCP connection. address of the source, determined from the TCP connection.
o The ID clause MAY contain an "@" as suggested in RFC 822, but this o The ID clause MAY contain an "@" as suggested in RFC 822, but this
is not required. is not required.
o If the FOR clause appears, it MUST contain exactly one <path> o If the FOR clause appears, it MUST contain exactly one <path>
entry, even when multiple RCPT commands have been given. Multiple entry, even when multiple RCPT commands have been given. Multiple
<path>s raise some security issues and have been deprecated, see <path>s raise some security issues and have been deprecated, see
Section 7.2. [[CREF161: [2821]Note to Alfred Hoenes, 20080212]] Section 7.2.
An Internet mail program MUST NOT change or delete [[CREF162: An Internet mail program MUST NOT change or delete a Received: line
[2821]Tony 20080213 #10]] a Received: line that was previously added that was previously added to the message header section. SMTP
to the message header section. [[CREF163: [2821]Issue 27 20070423]] servers MUST prepend Received lines to messages; they MUST NOT change
SMTP servers MUST prepend Received lines to messages; they MUST NOT the order of existing lines or insert Received lines in any other
change the order of existing lines or insert Received lines in any location.
other location.
As the Internet grows, comparability of Received header fields is As the Internet grows, comparability of Received header fields is
important for detecting problems, especially slow relays. SMTP important for detecting problems, especially slow relays. SMTP
servers that create Received header fields SHOULD use explicit servers that create Received header fields SHOULD use explicit
offsets in the dates (e.g., -0800), rather than time zone names of offsets in the dates (e.g., -0800), rather than time zone names of
any type. Local time (with an offset) SHOULD be used rather than UT any type. Local time (with an offset) SHOULD be used rather than UT
when feasible. [[CREF164: [2821]Preferred->Should, etc. Issue 16 when feasible. This formulation allows slightly more information
20070421]] This formulation allows slightly more information about about local circumstances to be specified. If UT is needed, the
local circumstances to be specified. If UT is needed, the receiver receiver need merely do some simple arithmetic to convert the values.
need merely do some simple arithmetic to convert the values. Use of Use of UT loses information about the time zone-location of the
UT loses information about the time zone-location of the server. If server. If it is desired to supply a time zone name, it SHOULD be
it is desired to supply a time zone name, it SHOULD be included in a included in a comment.
comment.
When the delivery SMTP server makes the "final delivery" of a When the delivery SMTP server makes the "final delivery" of a
message, it inserts a return-path line at the beginning of the mail message, it inserts a return-path line at the beginning of the mail
data. This use of return-path is required; mail systems MUST support data. This use of return-path is required; mail systems MUST support
it. The return-path line preserves the information in the <reverse- it. The return-path line preserves the information in the <reverse-
path> from the MAIL command. Here, final delivery means the message path> from the MAIL command. Here, final delivery means the message
has left the SMTP environment. Normally, this would mean it had been has left the SMTP environment. Normally, this would mean it had been
delivered to the destination user or an associated mail drop, but in delivered to the destination user or an associated mail drop, but in
some cases it may be further processed and transmitted by another some cases it may be further processed and transmitted by another
mail system. mail system.
skipping to change at page 64, line 19 skipping to change at page 60, line 10
It is possible for the mailbox in the return path to be different It is possible for the mailbox in the return path to be different
from the actual sender's mailbox, for example, if error responses are from the actual sender's mailbox, for example, if error responses are
to be delivered to a special error handling mailbox rather than to to be delivered to a special error handling mailbox rather than to
the message sender. When mailing lists are involved, this the message sender. When mailing lists are involved, this
arrangement is common and useful as a means of directing errors to arrangement is common and useful as a means of directing errors to
the list maintainer rather than the message originator. the list maintainer rather than the message originator.
The text above implies that the final mail data will begin with a The text above implies that the final mail data will begin with a
return path line, followed by one or more time stamp lines. These return path line, followed by one or more time stamp lines. These
lines will be followed by the rest of the mail data: first the lines will be followed by the rest of the mail data: first the
balance of the mail header section [[CREF165: [2821]Issue 27 balance of the mail header section and then the body (RFC 5322 [11]).
20070423]] and then the body (RFC 5322 [11]).
It is sometimes difficult for an SMTP server to determine whether or It is sometimes difficult for an SMTP server to determine whether or
not it is making final delivery since forwarding or other operations not it is making final delivery since forwarding or other operations
may occur after the message is accepted for delivery. Consequently, may occur after the message is accepted for delivery. Consequently,
any further (forwarding, gateway, or relay) systems MAY remove the any further (forwarding, gateway, or relay) systems MAY remove the
return path and rebuild the MAIL command as needed to ensure that return path and rebuild the MAIL command as needed to ensure that
exactly one such line appears in a delivered message. [[CREF166: exactly one such line appears in a delivered message.
[2821]??? This, and subsequent paragraph, need harmonizing -Jck ???
]]
A message-originating SMTP system SHOULD NOT send a message that A message-originating SMTP system SHOULD NOT send a message that
already contains a Return-path header field. SMTP servers performing already contains a Return-path header field. SMTP servers performing
a relay function MUST NOT inspect the message data, and especially a relay function MUST NOT inspect the message data, and especially
not to the extent needed to determine if Return-path header fields not to the extent needed to determine if Return-path header fields
are present. SMTP servers making final delivery MAY remove Return- are present. SMTP servers making final delivery MAY remove Return-
path header fields [[CREF167: [2821]Issue 27 20070423]] before adding path header fields before adding their own.
their own.
The primary purpose of the Return-path is to designate the address to The primary purpose of the Return-path is to designate the address to
which messages indicating non-delivery or other mail system failures which messages indicating non-delivery or other mail system failures
are to be sent. For this to be unambiguous, exactly one return path are to be sent. For this to be unambiguous, exactly one return path
SHOULD be present when the message is delivered. Systems using RFC SHOULD be present when the message is delivered. Systems using RFC
822 syntax with non-SMTP transports SHOULD designate an unambiguous 822 syntax with non-SMTP transports SHOULD designate an unambiguous
address, associated with the transport envelope, to which error address, associated with the transport envelope, to which error
reports (e.g., non-delivery messages) should be sent. reports (e.g., non-delivery messages) should be sent.
Historical note: Text in RFC 822 that appears to contradict the use Historical note: Text in RFC 822 that appears to contradict the use
skipping to change at page 65, line 36 skipping to change at page 61, line 22
recipients. In such cases, the response to the DATA command MUST be recipients. In such cases, the response to the DATA command MUST be
an OK reply. However, the SMTP server MUST compose and send an an OK reply. However, the SMTP server MUST compose and send an
"undeliverable mail" notification message to the originator of the "undeliverable mail" notification message to the originator of the
message. message.
A single notification listing all of the failed recipients or A single notification listing all of the failed recipients or
separate notification messages MUST be sent for each failed separate notification messages MUST be sent for each failed
recipient. For economy of processing by the sender, the former recipient. For economy of processing by the sender, the former
SHOULD be used when possible. Note that the key difference between SHOULD be used when possible. Note that the key difference between
handling aliases (Section 3.9.1) and forwarding (this subsection) is handling aliases (Section 3.9.1) and forwarding (this subsection) is
the change to the backward-pointing address in this case. [[CREF168: the change to the backward-pointing address in this case. All
[2821]Preferred->Should, etc. here and below. Issue 16 20070421]] notification messages about undeliverable mail MUST be sent using the
All notification messages about undeliverable mail MUST be sent using MAIL command (even if they result from processing the obsolete SEND,
the MAIL command (even if they result from processing the obsolete SOML, or SAML commands) and MUST use a null return path as discussed
SEND, SOML, or SAML commands) and MUST use a null return path as in Section 3.6.
discussed in Section 3.6.
The time stamp line and the return path line are formally defined as The time stamp line and the return path line are formally defined as
follows (the definitions for "FWS" and "CFWS" appear in RFC 5322 follows (the definitions for "FWS" and "CFWS" appear in RFC 5322
[11]): [11]):
Return-path-line = "Return-Path:" FWS Reverse-path <CRLF> Return-path-line = "Return-Path:" FWS Reverse-path <CRLF>
Time-stamp-line = "Received:" FWS Stamp <CRLF> Time-stamp-line = "Received:" FWS Stamp <CRLF>
Stamp = From-domain By-domain Opt-info [CFWS] [[CREF169:
[2821]20050619 Pete Resnick/ "Richard O. Hammer" Stamp = From-domain By-domain Opt-info [CFWS] ";"
<ROHammer@earthlink.net>, 20040222, here and below]]
";"
FWS date-time FWS date-time
; where "date-time" is as defined in RFC 5322 [11] ; where "date-time" is as defined in RFC 5322 [11]
; but the "obs-" forms, especially two-digit ; but the "obs-" forms, especially two-digit
; years, are prohibited in SMTP and MUST NOT be used. ; years, are prohibited in SMTP and MUST NOT be used.
From-domain = "FROM" FWS Extended-Domain From-domain = "FROM" FWS Extended-Domain
By-domain = CFWS "BY" FWS Extended-Domain By-domain = CFWS "BY" FWS Extended-Domain
Extended-Domain = Domain / Extended-Domain = Domain /
( Domain FWS "(" TCP-info ")" ) / ( Domain FWS "(" TCP-info ")" ) /
( address-literal FWS "(" TCP-info ")" ) ( address-literal FWS "(" TCP-info ")" )
TCP-info = address-literal / ( Domain FWS address-literal ) TCP-info = address-literal / ( Domain FWS address-literal )
; Information derived by server from TCP connection ; Information derived by server from TCP connection
; not client EHLO. ; not client EHLO.
Opt-info = [Via] [With] [ID] [For] Opt-info = [Via] [With] [ID] [For]
[Additional-Registered-Clauses] [Additional-Registered-Clauses]
[[CREF170: [2821] JcK:20071015 - the additional-...
stuff, here and below, added per issue 37 and
discussion with Tony.]]
Via = CFWS "VIA" FWS Link Via = CFWS "VIA" FWS Link
With = CFWS "WITH" FWS Protocol With = CFWS "WITH" FWS Protocol
ID = CFWS "ID" FWS ( Atom / msg-id ) ID = CFWS "ID" FWS ( Atom / msg-id )
; msg-id is defined in RFC 5322 [11] [[CREF171: ; msg-id is defined in RFC 5322 [11]
[2821]20050619: Should "string" be removed here,
leaving only "msg-id", which would be consistent with
5322? Or is the additional flexibility needed for,
e.g., gateways ??? See Klensin/ Resnick/ Lilly
correspondence of 20010625]] [[CREF172: [2821]Decision
20070403, per note from Tony Hansen ("issue 5"):
changed "string" to "atom" in -02c ]]
For = CFWS "FOR" FWS ( Path / Mailbox ) [[CREF173: For = CFWS "FOR" FWS ( Path / Mailbox )
[2821]If more than one path or mailbox is really
permitted, be sure they are separated. Per Brett
Watson <brett@ics.mq.edu.au> 20040304. Syntax fixed
per Hari Hurtta 20070428. JcK: Reduced to one path,
20071012, -05)]]
Additional-Registered-Clauses = 1* (CFWS Atom FWS String) Additional-Registered-Clauses = 1* (CFWS Atom FWS String)
[[CREF174: [5321bis] 5321 errata #1683, 20090215, [[CREF23: [5321bis] 5321 errata #1683, 20090215,
Roberto Javier Godoy, rjgodoy@fich.unl.edu.ar]] Roberto Javier Godoy, rjgodoy@fich.unl.edu.ar]]
[[CREF175: [2821] Tony 20071016: We *may* be asked to
change String to read something like: ( String / Path
/ Mailbox / msg-id ) but I'll let people bring it up
on the list. In particular, we can't really support a
modified uFor from smtp-ext without Path / Mailbox.]]
; Additional standard clauses may be added in this ; Additional standard clauses may be added in this
; location by future standards and registration with ; location by future standards and registration with
; IANA. SMTP servers SHOULD NOT use unregistered ; IANA. SMTP servers SHOULD NOT use unregistered
; names. See Section 8. ; names. See Section 8.
Link = "TCP" / Addtl-Link Link = "TCP" / Addtl-Link
Addtl-Link = Atom Addtl-Link = Atom
; Additional standard names for links are ; Additional standard names for links are
; registered with the Internet Assigned Numbers ; registered with the Internet Assigned Numbers
skipping to change at page 67, line 34 skipping to change at page 62, line 42
; with non-Internet transports. SMTP servers ; with non-Internet transports. SMTP servers
; SHOULD NOT use unregistered names. ; SHOULD NOT use unregistered names.
Protocol = "ESMTP" / "SMTP" / Attdl-Protocol Protocol = "ESMTP" / "SMTP" / Attdl-Protocol
Addtl-Protocol = Atom Addtl-Protocol = Atom
; Additional standard names for protocols are ; Additional standard names for protocols are
; registered with the Internet Assigned Numbers ; registered with the Internet Assigned Numbers
; Authority (IANA) in the "mail parameters" ; Authority (IANA) in the "mail parameters"
; registry [9]. SMTP servers SHOULD NOT ; registry [9]. SMTP servers SHOULD NOT
; use unregistered names. [[CREF176: [2821] 6/19/2005 ; use unregistered names.
Indication of the parameter registry added after RFC
3848 was approved, but its keywords have not been
added here. Explicit reference to 3848 added
20070401. ]]
[[CREF177: [2821] JcK: Text about additional trace fields removed,
20071015 - redundant. ]]
4.5. Additional Implementation Issues 4.5. Additional Implementation Issues
4.5.1. Minimum Implementation 4.5.1. Minimum Implementation
In order to make SMTP workable, the following minimum implementation In order to make SMTP workable, the following minimum implementation
MUST be provided by all receivers. [[CREF178: MUST be provided by all receivers. The following commands MUST be
[2821]Preferred->Should, etc. Issue 16 20070421]] The following supported to conform to this specification:
commands MUST be supported to conform to this specification:
EHLO EHLO
HELO HELO
MAIL MAIL
RCPT RCPT
DATA DATA
RSET RSET
NOOP NOOP
QUIT QUIT
VRFY VRFY
skipping to change at page 69, line 36 skipping to change at page 64, line 38
Clients MAY attempt to transmit these, but MUST be prepared for a Clients MAY attempt to transmit these, but MUST be prepared for a
server to reject them if they cannot be handled by it. To the server to reject them if they cannot be handled by it. To the
maximum extent possible, implementation techniques that impose no maximum extent possible, implementation techniques that impose no
limits on the length of these objects should be used. limits on the length of these objects should be used.
Extensions to SMTP may involve the use of characters that occupy more Extensions to SMTP may involve the use of characters that occupy more
than a single octet each. This section therefore specifies lengths than a single octet each. This section therefore specifies lengths
in octets where absolute lengths, rather than character counts, are in octets where absolute lengths, rather than character counts, are
intended. intended.
[[CREF179: [5321bis] [[Note in Draft: Klensin 20191126: Given the [[CREF24: [5321bis] [[Note in Draft: Klensin 20191126: Given the
controversy on the SMTP mailing list between 20191123 and now about controversy on the SMTP mailing list between 20191123 and now about
maximum lengths, is the above adequate or is further tuning of the maximum lengths, is the above adequate or is further tuning of the
limit text below needed? ]]]] limit text below needed? ]]]]
4.5.3.1.1. Local-part 4.5.3.1.1. Local-part
The maximum total length of a user name or other local-part is 64 The maximum total length of a user name or other local-part is 64
octets. octets.
4.5.3.1.2. Domain 4.5.3.1.2. Domain
skipping to change at page 70, line 31 skipping to change at page 65, line 31
4.5.3.1.6. Text Line 4.5.3.1.6. Text Line
The maximum total length of a text line including the <CRLF> is 1000 The maximum total length of a text line including the <CRLF> is 1000
octets (not counting the leading dot duplicated for transparency). octets (not counting the leading dot duplicated for transparency).
This number may be increased by the use of SMTP Service Extensions. This number may be increased by the use of SMTP Service Extensions.
4.5.3.1.7. Message Content 4.5.3.1.7. Message Content
The maximum total length of a message content (including any message The maximum total length of a message content (including any message
header section [[CREF180: [2821]Issue 27 20070423]] as well as the header section as well as the message body) MUST BE at least 64K
message body) MUST BE at least 64K octets. Since the introduction of octets. Since the introduction of Internet Standards for multimedia
Internet Standards for multimedia mail (RFC 2045 [29]), message mail (RFC 2045 [29]), message lengths on the Internet have grown
lengths on the Internet have grown dramatically, and message size dramatically, and message size restrictions should be avoided if at
restrictions should be avoided if at all possible. SMTP server all possible. SMTP server systems that must impose restrictions
systems that must impose restrictions SHOULD implement the "SIZE" SHOULD implement the "SIZE" service extension of RFC 1870 [4], and
service extension of RFC 1870 [4], and SMTP client systems that will SMTP client systems that will send large messages SHOULD utilize it
send large messages SHOULD utilize it when possible. when possible.
4.5.3.1.8. Recipient Buffer 4.5.3.1.8. Recipient Buffer
The minimum total number of recipients that MUST be buffered is 100 The minimum total number of recipients that MUST be buffered is 100
recipients. Rejection of messages (for excessive recipients) with recipients. Rejection of messages (for excessive recipients) with
fewer than 100 RCPT commands is a violation of this specification. fewer than 100 RCPT commands is a violation of this specification.
[[CREF181: [2821]20050619 See note from "Derek J. Balling"
<dredd@megacity.org>, 20020307, recommending a change to "should"
here for spam control. Rejected--- too unpredictable and the escapes
of the security considerations section give the needed flexibility.]]
The general principle that relaying SMTP server MUST NOT, and The general principle that relaying SMTP server MUST NOT, and
delivery SMTP servers SHOULD NOT, perform validation tests on message delivery SMTP servers SHOULD NOT, perform validation tests on message
header fields [[CREF182: [2821]Issue 27 20070423]] suggests that header fields suggests that messages SHOULD NOT be rejected based on
messages SHOULD NOT be rejected based on the total number of the total number of recipients shown in header fields. A server that
recipients shown in header fields. [[CREF183:
[2821]Preferred->Should, etc. Issue 16 20070421]] A server that
imposes a limit on the number of recipients MUST behave in an orderly imposes a limit on the number of recipients MUST behave in an orderly
fashion, such as rejecting additional addresses over its limit rather fashion, such as rejecting additional addresses over its limit rather
than silently discarding addresses previously accepted. A client than silently discarding addresses previously accepted. A client
that needs to deliver a message containing over 100 RCPT commands that needs to deliver a message containing over 100 RCPT commands
SHOULD be prepared to transmit in 100-recipient "chunks" if the SHOULD be prepared to transmit in 100-recipient "chunks" if the
server declines to accept more than 100 recipients in a single server declines to accept more than 100 recipients in a single
message. message.
4.5.3.1.9. Treatment When Limits Exceeded 4.5.3.1.9. Treatment When Limits Exceeded
skipping to change at page 72, line 15 skipping to change at page 67, line 8
If an SMTP server has an implementation limit on the number of RCPT If an SMTP server has an implementation limit on the number of RCPT
commands and this limit is exhausted, it MUST use a response code of commands and this limit is exhausted, it MUST use a response code of
452 (but the client SHOULD also be prepared for a 552, as noted 452 (but the client SHOULD also be prepared for a 552, as noted
above). If the server has a configured site-policy limitation on the above). If the server has a configured site-policy limitation on the
number of RCPT commands, it MAY instead use a 5yz response code. In number of RCPT commands, it MAY instead use a 5yz response code. In
particular, if the intent is to prohibit messages with more than a particular, if the intent is to prohibit messages with more than a
site-specified number of recipients, rather than merely limit the site-specified number of recipients, rather than merely limit the
number of recipients in a given mail transaction, it would be number of recipients in a given mail transaction, it would be
reasonable to return a 503 response to any DATA command received reasonable to return a 503 response to any DATA command received
subsequent to the 452 (or 552) code or to simply return the 503 after subsequent to the 452 (or 552) code or to simply return the 503 after
DATA without returning any previous negative response. [[CREF184: DATA without returning any previous negative response.
[2821]20050619 Interaction with Steve Dorner and Pete Resnick,
20021206]]
4.5.3.2. Timeouts 4.5.3.2. Timeouts
An SMTP client MUST provide a timeout mechanism. It MUST use per- An SMTP client MUST provide a timeout mechanism. It MUST use per-
command timeouts rather than somehow trying to time the entire mail command timeouts rather than somehow trying to time the entire mail
transaction. Timeouts SHOULD be easily reconfigurable, preferably transaction. Timeouts SHOULD be easily reconfigurable, preferably
without recompiling the SMTP code. To implement this, a timer is set without recompiling the SMTP code. To implement this, a timer is set
for each SMTP command and for each buffer of the data transfer. The for each SMTP command and for each buffer of the data transfer. The
latter means that the overall timeout is inherently proportional to latter means that the overall timeout is inherently proportional to
the size of the message. the size of the message.
skipping to change at page 73, line 23 skipping to change at page 68, line 12
the final period terminating the message data, it typically performs the final period terminating the message data, it typically performs
processing to deliver the message to a user mailbox. A spurious processing to deliver the message to a user mailbox. A spurious
timeout at this point would be very wasteful and would typically timeout at this point would be very wasteful and would typically
result in delivery of multiple copies of the message, since it has result in delivery of multiple copies of the message, since it has
been successfully sent and the server has accepted responsibility for been successfully sent and the server has accepted responsibility for
delivery. See Section 6.1 for additional discussion. delivery. See Section 6.1 for additional discussion.
4.5.3.2.7. Server Timeout: 5 Minutes. 4.5.3.2.7. Server Timeout: 5 Minutes.
An SMTP server SHOULD have a timeout of at least 5 minutes while it An SMTP server SHOULD have a timeout of at least 5 minutes while it
is awaiting the next command from the sender. [[CREF185: [2821]Tony is awaiting the next command from the sender.
20080213#29]]
4.5.4. Retry Strategies 4.5.4. Retry Strategies
The common structure of a host SMTP implementation includes user The common structure of a host SMTP implementation includes user
mailboxes, one or more areas for queuing messages in transit, and one mailboxes, one or more areas for queuing messages in transit, and one
or more daemon processes for sending and receiving mail. The exact or more daemon processes for sending and receiving mail. The exact
structure will vary depending on the needs of the users on the host structure will vary depending on the needs of the users on the host
and the number and size of mailing lists supported by the host. We and the number and size of mailing lists supported by the host. We
describe several optimizations that have proved helpful, particularly describe several optimizations that have proved helpful, particularly
for mailers supporting high traffic levels. for mailers supporting high traffic levels.
skipping to change at page 74, line 11 skipping to change at page 68, line 48
The sender MUST delay retrying a particular destination after one The sender MUST delay retrying a particular destination after one
attempt has failed. In general, the retry interval SHOULD be at attempt has failed. In general, the retry interval SHOULD be at
least 30 minutes; however, more sophisticated and variable strategies least 30 minutes; however, more sophisticated and variable strategies
will be beneficial when the SMTP client can determine the reason for will be beneficial when the SMTP client can determine the reason for
non-delivery. non-delivery.
Retries continue until the message is transmitted or the sender gives Retries continue until the message is transmitted or the sender gives
up; the give-up time generally needs to be at least 4-5 days. It MAY up; the give-up time generally needs to be at least 4-5 days. It MAY
be appropriate to set a shorter maximum number of retries for non- be appropriate to set a shorter maximum number of retries for non-
delivery notifications and equivalent error messages than for delivery notifications and equivalent error messages than for
standard messages. [[CREF186: [2821]20050619 Part of the "bound" standard messages. The parameters to the retry algorithm MUST be
discussion, cf section 6.]] The parameters to the retry algorithm configurable.
MUST be configurable.
A client SHOULD keep a list of hosts it cannot reach and A client SHOULD keep a list of hosts it cannot reach and
corresponding connection timeouts, rather than just retrying queued corresponding connection timeouts, rather than just retrying queued
mail items. mail items.
Experience suggests that failures are typically transient (the target Experience suggests that failures are typically transient (the target
system or its connection has crashed), favoring a policy of two system or its connection has crashed), favoring a policy of two
connection attempts in the first hour the message is in the queue, connection attempts in the first hour the message is in the queue,
and then backing off to one every two or three hours. and then backing off to one every two or three hours.
skipping to change at page 75, line 13 skipping to change at page 69, line 49
responses to the MAIL command MUST NOT be cached. responses to the MAIL command MUST NOT be cached.
When a mail message is to be delivered to multiple recipients, and When a mail message is to be delivered to multiple recipients, and
the SMTP server to which a copy of the message is to be sent is the the SMTP server to which a copy of the message is to be sent is the
same for multiple recipients, then only one copy of the message same for multiple recipients, then only one copy of the message
SHOULD be transmitted. That is, the SMTP client SHOULD use the SHOULD be transmitted. That is, the SMTP client SHOULD use the
command sequence: MAIL, RCPT, RCPT, ..., RCPT, DATA instead of the command sequence: MAIL, RCPT, RCPT, ..., RCPT, DATA instead of the
sequence: MAIL, RCPT, DATA, ..., MAIL, RCPT, DATA. However, if there sequence: MAIL, RCPT, DATA, ..., MAIL, RCPT, DATA. However, if there
are very many addresses, a limit on the number of RCPT commands per are very many addresses, a limit on the number of RCPT commands per
MAIL command MAY be imposed. This efficiency feature SHOULD be MAIL command MAY be imposed. This efficiency feature SHOULD be
implemented. [[CREF187: [2821]Preferred->Should, etc. Issue 16 implemented.
20070421]]
Similarly, to achieve timely delivery, the SMTP client MAY support Similarly, to achieve timely delivery, the SMTP client MAY support
multiple concurrent outgoing mail transactions. However, some limit multiple concurrent outgoing mail transactions. However, some limit
may be appropriate to protect the host from devoting all its may be appropriate to protect the host from devoting all its
resources to mail. resources to mail.
4.5.4.2. Receiving Strategy 4.5.4.2. Receiving Strategy
The SMTP server SHOULD attempt to keep a pending listen on the SMTP The SMTP server SHOULD attempt to keep a pending listen on the SMTP
port (specified by IANA as port 25) [[CREF188: [2821]20050619 Eric port (specified by IANA as port 25) at all times. This requires the
Hall, 20050216]] at all times. This requires the support of multiple support of multiple incoming TCP connections for SMTP. Some limit
incoming TCP connections for SMTP. Some limit MAY be imposed, but MAY be imposed, but servers that cannot handle more than one SMTP
servers that cannot handle more than one SMTP transaction at a time transaction at a time are not in conformance with the intent of this
are not in conformance with the intent of this specification. specification.
As discussed above, when the SMTP server receives mail from a As discussed above, when the SMTP server receives mail from a
particular host address, it could activate its own SMTP queuing particular host address, it could activate its own SMTP queuing
mechanisms to retry any mail pending for that host address. mechanisms to retry any mail pending for that host address.
4.5.5. Messages with a Null Reverse-Path 4.5.5. Messages with a Null Reverse-Path
There are several types of notification messages that are required by There are several types of notification messages that are required by
existing and proposed Standards to be sent with a null reverse-path, existing and proposed Standards to be sent with a null reverse-path,
namely non-delivery notifications as discussed in Section 3.7, other namely non-delivery notifications as discussed in Section 3.7, other
skipping to change at page 76, line 10 skipping to change at page 70, line 45
All other types of messages (i.e., any message which is not required All other types of messages (i.e., any message which is not required
by a Standards-Track RFC to have a null reverse-path) SHOULD be sent by a Standards-Track RFC to have a null reverse-path) SHOULD be sent
with a valid, non-null reverse-path. with a valid, non-null reverse-path.
Implementers of automated email processors should be careful to make Implementers of automated email processors should be careful to make
sure that the various kinds of messages with a null reverse-path are sure that the various kinds of messages with a null reverse-path are
handled correctly. In particular, such systems SHOULD NOT reply to handled correctly. In particular, such systems SHOULD NOT reply to
messages with a null reverse-path, and they SHOULD NOT add a non-null messages with a null reverse-path, and they SHOULD NOT add a non-null
reverse-path, or change a null reverse-path to a non-null one, to reverse-path, or change a null reverse-path to a non-null one, to
such messages when forwarding. [[CREF189: [2821] New text and slight such messages when forwarding.
modifications per Ned and SM, 20071117]]
5. Address Resolution and Mail Handling 5. Address Resolution and Mail Handling
5.1. Locating the Target Host 5.1. Locating the Target Host
Once an SMTP client lexically identifies a domain to which mail will Once an SMTP client lexically identifies a domain to which mail will
be delivered for processing (as described in Sections 2.3.5 and 3.6), be delivered for processing (as described in Sections 2.3.5 and 3.6),
a DNS lookup MUST be performed to resolve the domain name (RFC 1035 a DNS lookup MUST be performed to resolve the domain name (RFC 1035
[7]). The names are expected to be fully-qualified domain names [7]). The names are expected to be fully-qualified domain names
(FQDNs): mechanisms for inferring FQDNs from partial names or local (FQDNs): mechanisms for inferring FQDNs from partial names or local
aliases are outside of this specification. Due to a history of aliases are outside of this specification. Due to a history of
problems, SMTP servers used for initial submission of messages SHOULD problems, SMTP servers used for initial submission of messages SHOULD
NOT make such inferences (Message Submission Servers [43] have NOT make such inferences (Message Submission Servers [43] have
somewhat more flexibility) and intermediate (relay) SMTP servers MUST somewhat more flexibility) and intermediate (relay) SMTP servers MUST
NOT make them. [[CREF190: [2821]Preferred->Should, etc. Issue 16 NOT make them.
20070421]] [[CREF191: [2821] Needed to complete the "single component
domain" fix-ups. 20070413 JcK]]
The lookup first attempts to locate an MX record associated with the The lookup first attempts to locate an MX record associated with the
name. If a CNAME record is found, the resulting name is processed as name. If a CNAME record is found, the resulting name is processed as
if it were the initial name. If a non-existent domain error is if it were the initial name. If a non-existent domain error is
returned, this situation MUST be reported as an error. If a returned, this situation MUST be reported as an error. If a
temporary error is returned, the message MUST be queued and retried temporary error is returned, the message MUST be queued and retried
later (see Section 4.5.4.1). If an empty list of MXs is returned, later (see Section 4.5.4.1). If an empty list of MXs is returned,
the address is treated as if it was associated with an implicit MX the address is treated as if it was associated with an implicit MX
RR, with a preference of 0, pointing to that host. If MX records are RR, with a preference of 0, pointing to that host. If MX records are
present, but none of them are usable, or the implicit MX is unusable, present, but none of them are usable, or the implicit MX is unusable,
this situation MUST be reported as an error. [[CREF192: [2821]Group this situation MUST be reported as an error.
decision reported in Tony's note 20080414, text from Glenn Anderson
20080408]]
If one or more MX RRs are found for a given name, SMTP systems MUST If one or more MX RRs are found for a given name, SMTP systems MUST
NOT utilize any address RRs associated with that name unless they are NOT utilize any address RRs associated with that name unless they are
located using the MX RRs; the "implicit MX" rule above applies only located using the MX RRs; the "implicit MX" rule above applies only
if there are no MX records present. If MX records are present, but if there are no MX records present. If MX records are present, but
none of them are usable, this situation MUST be reported as an error. none of them are usable, this situation MUST be reported as an error.
When a domain name associated with an MX RR is looked up and the When a domain name associated with an MX RR is looked up and the
associated data field obtained, the data field of that response MUST associated data field obtained, the data field of that response MUST
contain a domain name that conforms to the specifications of contain a domain name that conforms to the specifications of
skipping to change at page 77, line 4 skipping to change at page 71, line 38
If one or more MX RRs are found for a given name, SMTP systems MUST If one or more MX RRs are found for a given name, SMTP systems MUST
NOT utilize any address RRs associated with that name unless they are NOT utilize any address RRs associated with that name unless they are
located using the MX RRs; the "implicit MX" rule above applies only located using the MX RRs; the "implicit MX" rule above applies only
if there are no MX records present. If MX records are present, but if there are no MX records present. If MX records are present, but
none of them are usable, this situation MUST be reported as an error. none of them are usable, this situation MUST be reported as an error.
When a domain name associated with an MX RR is looked up and the When a domain name associated with an MX RR is looked up and the
associated data field obtained, the data field of that response MUST associated data field obtained, the data field of that response MUST
contain a domain name that conforms to the specifications of contain a domain name that conforms to the specifications of
Section 2.3.5. Section 2.3.5.
[[5321bis Editor's Note: Depending on how the "null MX" discussion [[5321bis Editor's Note: Depending on how the "null MX" discussion
unfolds, some additional text may be in order here (20140718)]] unfolds, some additional text may be in order here (20140718)]]
That domain name, when queried, MUST return at least one address That domain name, when queried, MUST return at least one address
record (e.g., A or AAAA RR) that gives the IP address of the SMTP record (e.g., A or AAAA RR) that gives the IP address of the SMTP
server to which the message should be directed. Any other response, server to which the message should be directed. Any other response,
specifically including a value that will return a CNAME record when specifically including a value that will return a CNAME record when
queried, lies outside the scope of this Standard. The prohibition on queried, lies outside the scope of this Standard. The prohibition on
labels in the data that resolve to CNAMEs is discussed in more detail labels in the data that resolve to CNAMEs is discussed in more detail
in RFC 2181, Section 10.3 [32]. [[CREF193: [2821]Tony 20080212 #4, in RFC 2181, Section 10.3 [32].
New paragraph structure, Tony, 20080221, correspondence with John
Leslie 20080223 and 20080225]]
When the lookup succeeds, the mapping can result in a list of When the lookup succeeds, the mapping can result in a list of
alternative delivery addresses rather than a single address, because alternative delivery addresses rather than a single address, because
of multiple MX records, multihoming, or both. To provide reliable of multiple MX records, multihoming, or both. To provide reliable
mail transmission, the SMTP client MUST be able to try (and retry) mail transmission, the SMTP client MUST be able to try (and retry)
each of the relevant addresses in this list in order, until a each of the relevant addresses in this list in order, until a
delivery attempt succeeds. However, there MAY also be a configurable delivery attempt succeeds. However, there MAY also be a configurable
limit on the number of alternate addresses that can be tried. In any limit on the number of alternate addresses that can be tried. In any
case, the SMTP client SHOULD try at least two addresses. case, the SMTP client SHOULD try at least two addresses.
Two types of information are used to rank the host addresses: Two types of information are used to rank the host addresses:
multiple MX records, and multihomed hosts. multiple MX records, and multihomed hosts.
MX records contain a preference indication that MUST be used in MX records contain a preference indication that MUST be used in
sorting if more than one such record appears (see below). Lower sorting if more than one such record appears (see below). Lower
numbers are more preferred than higher ones. If there are multiple numbers are more preferred than higher ones. If there are multiple
destinations with the same preference and there is no clear reason to destinations with the same preference and there is no clear reason to
favor one (e.g., by recognition of an easily reached address), then favor one (e.g., by recognition of an easily reached address), then
the sender-SMTP MUST randomize them to spread the load across the sender-SMTP MUST randomize them to spread the load across
multiple mail exchangers for a specific organization. [[CREF194: multiple mail exchangers for a specific organization.
[2821]20050619 There was a long thread about this section, initiated
by Hector Santos, 20040104, and raising the question of a slight
inconsistency between this text and the text of RFC 1123. The
difference was discussed in DRUMS and the text here is believed to
reflect that discussion.]]
The destination host (perhaps taken from the preferred MX record) may The destination host (perhaps taken from the preferred MX record) may
be multihomed, in which case the domain name resolver will return a be multihomed, in which case the domain name resolver will return a
list of alternative IP addresses. It is the responsibility of the list of alternative IP addresses. It is the responsibility of the
domain name resolver interface to have ordered this list by domain name resolver interface to have ordered this list by
decreasing preference if necessary, and the SMTP sender MUST try them decreasing preference if necessary, and the SMTP sender MUST try them
in the order presented. in the order presented.
Although the capability to try multiple alternative addresses is Although the capability to try multiple alternative addresses is
required, specific installations may want to limit or disable the use required, specific installations may want to limit or disable the use
skipping to change at page 78, line 51 skipping to change at page 73, line 30
inconsistent with this specification. The appropriate actions to be inconsistent with this specification. The appropriate actions to be
taken either will depend on local circumstances, such as performance taken either will depend on local circumstances, such as performance
of the relevant networks and any conversions that might be necessary, of the relevant networks and any conversions that might be necessary,
or will be obvious (e.g., an IPv6-only client need not attempt to or will be obvious (e.g., an IPv6-only client need not attempt to
look up A RRs or attempt to reach IPv4-only servers). Designers of look up A RRs or attempt to reach IPv4-only servers). Designers of
SMTP implementations that might run in IPv6 or dual-stack SMTP implementations that might run in IPv6 or dual-stack
environments should study the procedures above, especially the environments should study the procedures above, especially the
comments about multihomed hosts, and, preferably, provide mechanisms comments about multihomed hosts, and, preferably, provide mechanisms
to facilitate operational tuning and mail interoperability between to facilitate operational tuning and mail interoperability between
IPv4 and IPv6 systems while considering local circumstances. IPv4 and IPv6 systems while considering local circumstances.
[[CREF195: [2821]Per mailing list discussion and discussion with ADs,
20070410. Further modified per comments from Ned Freed and offlist
editorial suggestions from SM 20070411. ]]
6. Problem Detection and Handling 6. Problem Detection and Handling
6.1. Reliable Delivery and Replies by Email 6.1. Reliable Delivery and Replies by Email
When the receiver-SMTP accepts a piece of mail (by sending a "250 OK" When the receiver-SMTP accepts a piece of mail (by sending a "250 OK"
message in response to DATA), it is accepting responsibility for message in response to DATA), it is accepting responsibility for
delivering or relaying the message. It must take this responsibility delivering or relaying the message. It must take this responsibility
seriously. It MUST NOT lose the message for frivolous reasons, such seriously. It MUST NOT lose the message for frivolous reasons, such
as because the host later crashes or because of a predictable as because the host later crashes or because of a predictable
skipping to change at page 80, line 9 skipping to change at page 74, line 32
acting as a relay and has no immediate access to the delivering acting as a relay and has no immediate access to the delivering
system. system.
To avoid receiving duplicate messages as the result of timeouts, a To avoid receiving duplicate messages as the result of timeouts, a
receiver-SMTP MUST seek to minimize the time required to respond to receiver-SMTP MUST seek to minimize the time required to respond to
the final <CRLF>.<CRLF> end of data indicator. See RFC 1047 [20] for the final <CRLF>.<CRLF> end of data indicator. See RFC 1047 [20] for
a discussion of this problem. a discussion of this problem.
6.2. Unwanted, Unsolicited, and "Attack" Messages 6.2. Unwanted, Unsolicited, and "Attack" Messages
[[CREF196: [2821] 20050619 This section added following a discussion Utility and predictability of the Internet mail system requires that
of "bounce rules" in late March 2004. ]] Utility and predictability messages that can be delivered should be delivered, regardless of any
of the Internet mail system requires that messages that can be syntax or other faults associated with those messages and regardless
delivered should be delivered, regardless of any syntax or other of their content. If they cannot be delivered, and cannot be
faults associated with those messages and regardless of their rejected by the SMTP server during the SMTP transaction, they should
content. If they cannot be delivered, and cannot be rejected by the be "bounced" (returned with non-delivery notification messages) as
SMTP server during the SMTP transaction, they should be "bounced" described above. In today's world, in which many SMTP server
(returned with non-delivery notification messages) [[CREF197: [2821] operators have discovered that the quantity of undesirable bulk email
Klensin 20070422]] as described above. In today's world, in which vastly exceeds the quantity of desired mail and in which accepting a
many SMTP server operators have discovered that the quantity of message may trigger additional undesirable traffic by providing
undesirable bulk email vastly exceeds the quantity of desired mail verification of the address, those principles may not be practical.
and in which accepting a message may trigger additional undesirable
traffic by providing verification of the address, those principles
may not be practical.
As discussed in Section 7.8 and Section 7.9 below, dropping mail As discussed in Section 7.8 and Section 7.9 below, dropping mail
without notification of the sender is [[CREF198: [2821]SM 20070411, without notification of the sender is permitted in practice.
"must be" -> "is" (JcK 20040717) ]] permitted in practice. However, However, it is extremely dangerous and violates a long tradition and
it is extremely dangerous and violates a long tradition and community community expectations that mail is either delivered or returned. If
expectations that mail is either delivered or returned. If silent silent message-dropping is misused, it could easily undermine
message-dropping is misused, it could easily undermine confidence in confidence in the reliability of the Internet's mail systems. So
the reliability of the Internet's mail systems. So silent dropping silent dropping of messages should be considered only in those cases
of messages should be considered only in those cases where there is where there is very high confidence that the messages are seriously
very high confidence that the messages are seriously fraudulent or fraudulent or otherwise inappropriate.
otherwise inappropriate.
To stretch the principle of delivery if possible even further, it may To stretch the principle of delivery if possible even further, it may
be a rational policy to not deliver mail that has an invalid return be a rational policy to not deliver mail that has an invalid return
address, although the history of the network is that users are address, although the history of the network is that users are
typically better served by delivering any message that can be typically better served by delivering any message that can be
delivered. Reliably determining that a return address is invalid can delivered. Reliably determining that a return address is invalid can
be a difficult and time-consuming process, especially if the putative be a difficult and time-consuming process, especially if the putative
sending system is not directly accessible or does not fully and sending system is not directly accessible or does not fully and
accurately support VRFY and, even if a "drop messages with invalid accurately support VRFY and, even if a "drop messages with invalid
return addresses" policy is adopted, it SHOULD [[CREF199: return addresses" policy is adopted, it SHOULD be applied only when
[2821]Upper-case per SM 20070411]] be applied only when there is there is near-certainty that the return addresses are, in fact,
near-certainty that the return addresses are, in fact, invalid. invalid.
Conversely, if a message is rejected because it is found to contain Conversely, if a message is rejected because it is found to contain
hostile content (a decision that is outside the scope of an SMTP hostile content (a decision that is outside the scope of an SMTP
server as defined in this document), rejection ("bounce") messages server as defined in this document), rejection ("bounce") messages
SHOULD NOT be sent unless the receiving site is confident that those SHOULD NOT be sent unless the receiving site is confident that those
messages will be usefully delivered. The preference and default in messages will be usefully delivered. The preference and default in
these cases is to avoid sending non-delivery messages when the these cases is to avoid sending non-delivery messages when the
incoming message is determined to contain hostile content. incoming message is determined to contain hostile content.
6.3. Loop Detection 6.3. Loop Detection
Simple counting of the number of "Received:" header fields [[CREF200: Simple counting of the number of "Received:" header fields in a
[2821]Issue 27 20070423]] in a message has proven to be an effective, message has proven to be an effective, although rarely optimal,
although rarely optimal, method of detecting loops in mail systems. method of detecting loops in mail systems. SMTP servers using this
SMTP servers using this technique SHOULD use a large rejection technique SHOULD use a large rejection threshold, normally at least
threshold, normally at least 100 Received entries. Whatever 100 Received entries. Whatever mechanisms are used, servers MUST
mechanisms are used, servers MUST contain provisions for detecting contain provisions for detecting and stopping trivial loops.
and stopping trivial loops.
6.4. Compensating for Irregularities 6.4. Compensating for Irregularities
Unfortunately, variations, creative interpretations, and outright Unfortunately, variations, creative interpretations, and outright
violations of Internet mail protocols do occur; some would suggest violations of Internet mail protocols do occur; some would suggest
that they occur quite frequently. The debate as to whether a well- that they occur quite frequently. The debate as to whether a well-
behaved SMTP receiver or relay should reject a malformed message, behaved SMTP receiver or relay should reject a malformed message,
attempt to pass it on unchanged, or attempt to repair it to increase attempt to pass it on unchanged, or attempt to repair it to increase
the odds of successful delivery (or subsequent reply) began almost the odds of successful delivery (or subsequent reply) began almost
with the dawn of structured network mail and shows no signs of with the dawn of structured network mail and shows no signs of
skipping to change at page 82, line 14 skipping to change at page 76, line 31
In response to these weak SMTP clients, many SMTP systems now In response to these weak SMTP clients, many SMTP systems now
complete messages that are delivered to them in incomplete or complete messages that are delivered to them in incomplete or
incorrect form. This strategy is generally considered appropriate incorrect form. This strategy is generally considered appropriate
when the server can identify or authenticate the client, and there when the server can identify or authenticate the client, and there
are prior agreements between them. By contrast, there is at best are prior agreements between them. By contrast, there is at best
great concern about fixes applied by a relay or delivery SMTP server great concern about fixes applied by a relay or delivery SMTP server
that has little or no knowledge of the user or client machine. Many that has little or no knowledge of the user or client machine. Many
of these issues are addressed by using a separate protocol, such as of these issues are addressed by using a separate protocol, such as
that defined in RFC 4409 [43], for message submission, rather than that defined in RFC 4409 [43], for message submission, rather than
using originating SMTP servers for that purpose. [[CREF201: using originating SMTP servers for that purpose.
[2821]Klensin 20070422]]
The following changes to a message being processed MAY be applied The following changes to a message being processed MAY be applied
when necessary by an originating SMTP server, or one used as the when necessary by an originating SMTP server, or one used as the
target of SMTP as an initial posting (message submission) protocol: target of SMTP as an initial posting (message submission) protocol:
o Addition of a message-id field when none appears o Addition of a message-id field when none appears
o Addition of a date, time, or time zone when none appears o Addition of a date, time, or time zone when none appears
o Correction of addresses to proper FQDN format o Correction of addresses to proper FQDN format
The less information the server has about the client, the less likely The less information the server has about the client, the less likely
these changes are to be correct and the more caution and conservatism these changes are to be correct and the more caution and conservatism
should be applied when considering whether or not to perform fixes should be applied when considering whether or not to perform fixes
and how. These changes MUST NOT be applied by an SMTP server that and how. These changes MUST NOT be applied by an SMTP server that
provides an intermediate relay function. provides an intermediate relay function.
In all cases, properly operating clients supplying correct In all cases, properly operating clients supplying correct
information are preferred to corrections by the SMTP server. In all information are preferred to corrections by the SMTP server. In all
cases, documentation SHOULD be provided in trace header fields and/or cases, documentation SHOULD be provided in trace header fields and/or
header field [[CREF202: [2821]Issue 27 20070423]] comments for header field comments for actions performed by the servers.
actions performed by the servers. [[CREF203:
[2821]Preferred->Should, etc. Issue 16 20070421]]
7. Security Considerations 7. Security Considerations
7.1. Mail Security and Spoofing 7.1. Mail Security and Spoofing
SMTP mail is inherently insecure in that it is feasible for even SMTP mail is inherently insecure in that it is feasible for even
fairly casual users to negotiate directly with receiving and relaying fairly casual users to negotiate directly with receiving and relaying
SMTP servers and create messages that will trick a naive recipient SMTP servers and create messages that will trick a naive recipient
into believing that they came from somewhere else. Constructing such into believing that they came from somewhere else. Constructing such
a message so that the "spoofed" behavior cannot be detected by an a message so that the "spoofed" behavior cannot be detected by an
skipping to change at page 83, line 40 skipping to change at page 78, line 9
that Sender header fields within the message data can be generated that Sender header fields within the message data can be generated
sensibly.) sensibly.)
This specification does not further address the authentication issues This specification does not further address the authentication issues
associated with SMTP other than to advocate that useful functionality associated with SMTP other than to advocate that useful functionality
not be disabled in the hope of providing some small margin of not be disabled in the hope of providing some small margin of
protection against a user who is trying to fake mail. protection against a user who is trying to fake mail.
7.2. "Blind" Copies 7.2. "Blind" Copies
Addresses that do not appear in the message header section [[CREF204: Addresses that do not appear in the message header section may appear
[2821]Issue 27 20070423]] may appear in the RCPT commands to an SMTP in the RCPT commands to an SMTP server for a number of reasons. The
server for a number of reasons. The two most common involve the use two most common involve the use of a mailing address as a "list
of a mailing address as a "list exploder" (a single address that exploder" (a single address that resolves into multiple addresses)
resolves into multiple addresses) and the appearance of "blind and the appearance of "blind copies". Especially when more than one
copies". Especially when more than one RCPT command is present, and RCPT command is present, and in order to avoid defeating some of the
in order to avoid defeating some of the purpose of these mechanisms, purpose of these mechanisms, SMTP clients and servers SHOULD NOT copy
SMTP clients and servers SHOULD NOT copy the full set of RCPT command the full set of RCPT command arguments into the header section,
arguments into the header section, [[CREF205: [2821]Issue 27 either as part of trace header fields or as informational or private-
20070423]] either as part of trace header fields or as informational extension header fields. [[CREF25: [rfc5321bis] [[Note in draft -
or private-extension header fields. [[CREF206: [rfc5321bis] [[Note Suggestion from 20070124 that got lost: delete "especially" and "the
in draft - Suggestion from 20070124 that got lost: delete full set of" -- copying the first one can be as harmful as copying
"especially" and "the full set of" -- copying the first one can be as all of them, at least without verifying that the addresses do appear
harmful as copying all of them, at least without verifying that the in the headers.]] Arnt Gulbrandsen, arnt@oryx.com, 2007.01.24
addresses do appear in the headers.]] Arnt Gulbrandsen, 1121+0100]] Since this rule is often violated in practice, and cannot
arnt@oryx.com, 2007.01.24 1121+0100]] Since this rule is often be enforced, sending SMTP systems that are aware of "bcc" use MAY
violated in practice, and cannot be enforced, sending SMTP systems find it helpful to send each blind copy as a separate message
that are aware of "bcc" use MAY find it helpful to send each blind transaction containing only a single RCPT command.
copy as a separate message transaction containing only a single RCPT
command.
There is no inherent relationship between either "reverse" (from There is no inherent relationship between either "reverse" (from
MAIL, SAML, etc., commands) or "forward" (RCPT) addresses in the SMTP MAIL, SAML, etc., commands) or "forward" (RCPT) addresses in the SMTP
transaction ("envelope") and the addresses in the header section. transaction ("envelope") and the addresses in the header section.
[[CREF207: [2821]Issue 27 20070423]] Receiving systems SHOULD NOT Receiving systems SHOULD NOT attempt to deduce such relationships and
attempt to deduce such relationships and use them to alter the header use them to alter the header section of the message for delivery.
section [[CREF208: [2821]Issue 27 20070423]] of the message for The popular "Apparently-to" header field is a violation of this
delivery. The popular "Apparently-to" header field is a violation of principle as well as a common source of unintended information
this principle as well as a common source of unintended information
disclosure and SHOULD NOT be used. disclosure and SHOULD NOT be used.
7.3. VRFY, EXPN, and Security 7.3. VRFY, EXPN, and Security
As discussed in Section 3.5, individual sites may want to disable As discussed in Section 3.5, individual sites may want to disable
either or both of VRFY or EXPN for security reasons (see below). As either or both of VRFY or EXPN for security reasons (see below). As
a corollary to the above, implementations that permit this MUST NOT a corollary to the above, implementations that permit this MUST NOT
appear to have verified addresses that are not, in fact, verified. appear to have verified addresses that are not, in fact, verified.
If a site disables these commands for security reasons, the SMTP If a site disables these commands for security reasons, the SMTP
server MUST return a 252 response, rather than a code that could be server MUST return a 252 response, rather than a code that could be
skipping to change at page 85, line 4 skipping to change at page 79, line 17
The use of EXPN to "harvest" addresses has increased as list The use of EXPN to "harvest" addresses has increased as list
administrators have installed protections against inappropriate uses administrators have installed protections against inappropriate uses
of the lists themselves. However, VRFY and EXPN are still useful for of the lists themselves. However, VRFY and EXPN are still useful for
authenticated users and within an administrative domain. For authenticated users and within an administrative domain. For
example, VRFY and EXPN are useful for performing internal audits of example, VRFY and EXPN are useful for performing internal audits of
how email gets routed to check and to make sure no one is how email gets routed to check and to make sure no one is
automatically forwarding sensitive mail outside the organization. automatically forwarding sensitive mail outside the organization.
Sites implementing SMTP authentication may choose to make VRFY and Sites implementing SMTP authentication may choose to make VRFY and
EXPN available only to authenticated requestors. Implementations EXPN available only to authenticated requestors. Implementations
SHOULD still provide support for EXPN, but sites SHOULD carefully SHOULD still provide support for EXPN, but sites SHOULD carefully
evaluate the tradeoffs. [[CREF209: [2821]New text per Tony Hansen, evaluate the tradeoffs.
20070503, Issue 2]]
[[CREF210: [2821]inserted in response to RFC 3552 suggestion]]
Whether disabling VRFY provides any real marginal security depends on Whether disabling VRFY provides any real marginal security depends on
a series of other conditions. In many cases, RCPT commands can be a series of other conditions. In many cases, RCPT commands can be
used to obtain the same information about address validity. On the used to obtain the same information about address validity. On the
other hand, especially in situations where determination of address other hand, especially in situations where determination of address
validity for RCPT commands is deferred until after the DATA command validity for RCPT commands is deferred until after the DATA command
is received, RCPT may return no information at all, while VRFY is is received, RCPT may return no information at all, while VRFY is
expected to make a serious attempt to determine validity before expected to make a serious attempt to determine validity before
generating a response code (see discussion above). generating a response code (see discussion above).
7.4. Mail Rerouting Based on the 251 and 551 Response Codes 7.4. Mail Rerouting Based on the 251 and 551 Response Codes
Before a client uses the 251 or 551 reply codes from a RCPT command Before a client uses the 251 or 551 reply codes from a RCPT command
to automatically update its future behavior (e.g., updating the to automatically update its future behavior (e.g., updating the
user's address book), it should be certain of the server's user's address book), it should be certain of the server's
authenticity. If it does not, it may be subject to a man in the authenticity. If it does not, it may be subject to a man in the
middle attack. [[CREF211: [2821] 2821bis-01 issue 10. Text per Tony middle attack.
Hansen, 20070503]]
7.5. Information Disclosure in Announcements 7.5. Information Disclosure in Announcements
There has been an ongoing debate about the tradeoffs between the There has been an ongoing debate about the tradeoffs between the
debugging advantages of announcing server type and version (and, debugging advantages of announcing server type and version (and,
sometimes, even server domain name) in the greeting response or in sometimes, even server domain name) in the greeting response or in
response to the HELP command and the disadvantages of exposing response to the HELP command and the disadvantages of exposing
information that might be useful in a potential hostile attack. The information that might be useful in a potential hostile attack. The
utility of the debugging information is beyond doubt. Those who utility of the debugging information is beyond doubt. Those who
argue for making it available point out that it is far better to argue for making it available point out that it is far better to
actually secure an SMTP server rather than hope that trying to actually secure an SMTP server rather than hope that trying to
conceal known vulnerabilities by hiding the server's precise identity conceal known vulnerabilities by hiding the server's precise identity
will provide more protection. Sites are encouraged to evaluate the will provide more protection. Sites are encouraged to evaluate the
tradeoff with that issue in mind; implementations SHOULD minimally tradeoff with that issue in mind; implementations SHOULD minimally
provide for making type and version information available in some way provide for making type and version information available in some way
to other network hosts. [[CREF212: [2821]Preferred->Should, etc. to other network hosts.
Issue 16 20070421]]
7.6. Information Disclosure in Trace Fields 7.6. Information Disclosure in Trace Fields
In some circumstances, such as when mail originates from within a LAN In some circumstances, such as when mail originates from within a LAN
whose hosts are not directly on the public Internet, trace whose hosts are not directly on the public Internet, trace
("Received") header fields produced in conformance with this ("Received") header fields produced in conformance with this
specification may disclose host names and similar information that specification may disclose host names and similar information that
would not normally be available. This ordinarily does not pose a would not normally be available. This ordinarily does not pose a
problem, but sites with special concerns about name disclosure should problem, but sites with special concerns about name disclosure should
be aware of it. Also, the optional FOR clause should be supplied be aware of it. Also, the optional FOR clause should be supplied
skipping to change at page 86, line 19 skipping to change at page 80, line 29
As discussed in Section 3.4, use of the 251 or 551 reply codes to As discussed in Section 3.4, use of the 251 or 551 reply codes to
identify the replacement address associated with a mailbox may identify the replacement address associated with a mailbox may
inadvertently disclose sensitive information. Sites that are inadvertently disclose sensitive information. Sites that are
concerned about those issues should ensure that they select and concerned about those issues should ensure that they select and
configure servers appropriately. configure servers appropriately.
7.8. Resistance to Attacks 7.8. Resistance to Attacks
In recent years, there has been an increase of attacks on SMTP In recent years, there has been an increase of attacks on SMTP
[[CREF213: [2821]20050619 Discussion with Jutta Degener, 20030730. servers, either in conjunction with attempts to discover addresses
Needs to be cleared with WG - see section 3.9.]] servers, either in for sending unsolicited messages or simply to make the servers
conjunction with attempts to discover addresses for sending inaccessible to others (i.e., as an application-level denial of
unsolicited messages or simply to make the servers inaccessible to service attack). While the means of doing so are beyond the scope of
others (i.e., as an application-level denial of service attack). this Standard, rational operational behavior requires that servers be
While the means of doing so are beyond the scope of this Standard, permitted to detect such attacks and take action to defend
rational operational behavior requires that servers be permitted to themselves. For example, if a server determines that a large number
detect such attacks and take action to defend themselves. For of RCPT TO commands are being sent, most or all with invalid
example, if a server determines that a large number of RCPT TO addresses, as part of such an attack, it would be reasonable for the
commands are being sent, most or all with invalid addresses, as part server to close the connection after generating an appropriate number
of such an attack, it would be reasonable for the server to close the of 5yz (normally 550) replies.
connection after generating an appropriate number of 5yz (normally
550) replies.
7.9. Scope of Operation of SMTP Servers 7.9. Scope of Operation of SMTP Servers
It is a well-established principle that an SMTP server may refuse to It is a well-established principle that an SMTP server may refuse to
accept mail for any operational or technical reason that makes sense accept mail for any operational or technical reason that makes sense
to the site providing the server. However, cooperation among sites to the site providing the server. However, cooperation among sites
and installations makes the Internet possible. If sites take and installations makes the Internet possible. If sites take
excessive advantage of the right to reject traffic, the ubiquity of excessive advantage of the right to reject traffic, the ubiquity of
email availability (one of the strengths of the Internet) will be email availability (one of the strengths of the Internet) will be
threatened; considerable care should be taken and balance maintained threatened; considerable care should be taken and balance maintained
if a site decides to be selective about the traffic it will accept if a site decides to be selective about the traffic it will accept
and process. and process.
In recent years, use of the relay function through arbitrary sites In recent years, use of the relay function through arbitrary sites
has been used as part of hostile efforts to hide the actual origins has been used as part of hostile efforts to hide the actual origins
of mail. Some sites have decided to limit the use of the relay of mail. Some sites have decided to limit the use of the relay
function to known or identifiable sources, and implementations SHOULD function to known or identifiable sources, and implementations SHOULD
provide the capability to perform this type of filtering. When mail provide the capability to perform this type of filtering. When mail
is rejected for these or other policy reasons, a 550 code SHOULD be is rejected for these or other policy reasons, a 550 code SHOULD be
used in response to EHLO (or HELO), [[CREF214: [2821]20050619 used in response to EHLO (or HELO), MAIL, or RCPT as appropriate.
Response to Vince Sabio note 20050302.]] MAIL, or RCPT as
appropriate.
8. IANA Considerations 8. IANA Considerations
IANA maintains three registries in support of this specification, all IANA maintains three registries in support of this specification, all
of which were created for RFC 2821 or earlier. This document expands of which were created for RFC 2821 or earlier. This document expands
the third one as specified below. The registry references listed are the third one as specified below. The registry references listed are
as of the time of publication; IANA does not guarantee the locations as of the time of publication; IANA does not guarantee the locations
associated with the URLs. The registries are as follows: associated with the URLs. The registries are as follows:
o The first, "Simple Mail Transfer Protocol (SMTP) Service o The first, "Simple Mail Transfer Protocol (SMTP) Service
skipping to change at page 87, line 42 skipping to change at page 81, line 48
and renewed by this specification, is a registry of link and and renewed by this specification, is a registry of link and
protocol identifiers to be used with the "via" and "with" protocol identifiers to be used with the "via" and "with"
subclauses of the time stamp ("Received:" header field) described subclauses of the time stamp ("Received:" header field) described
in Section 4.4. Link and protocol identifiers in addition to in Section 4.4. Link and protocol identifiers in addition to
those specified in this document may be registered only by those specified in this document may be registered only by
standardization or by way of an RFC-documented, IESG-approved, standardization or by way of an RFC-documented, IESG-approved,
Experimental protocol extension. This name space is for Experimental protocol extension. This name space is for
identification and not limited in size: the IESG is encouraged to identification and not limited in size: the IESG is encouraged to
approve on the basis of clear documentation and a distinct method approve on the basis of clear documentation and a distinct method
rather than preferences about the properties of the method itself. rather than preferences about the properties of the method itself.
[[CREF215: [2821]Added 20050707 after IETF list discussion about
registration policy]]
An additional subsection has been added to the "VIA link types" An additional subsection has been added to the "VIA link types"
and "WITH protocol types" subsections of this registry to contain and "WITH protocol types" subsections of this registry to contain
registrations of "Additional-registered-clauses" as described registrations of "Additional-registered-clauses" as described
above. The registry will contain clause names, a description, a above. The registry will contain clause names, a description, a
summary of the syntax of the associated String, and a reference. summary of the syntax of the associated String, and a reference.
As new clauses are defined, they may, in principle, specify As new clauses are defined, they may, in principle, specify
creation of their own registries if the Strings consist of creation of their own registries if the Strings consist of
reserved terms or keywords rather than less restricted strings. reserved terms or keywords rather than less restricted strings.
As with link and protocol identifiers, additional clauses may be As with link and protocol identifiers, additional clauses may be
skipping to change at page 94, line 12 skipping to change at page 88, line 12
Captured 2019-11-19 Captured 2019-11-19
Appendix A. TCP Transport Service Appendix A. TCP Transport Service
The TCP connection supports the transmission of 8-bit bytes. The The TCP connection supports the transmission of 8-bit bytes. The
SMTP data is 7-bit ASCII characters. Each character is transmitted SMTP data is 7-bit ASCII characters. Each character is transmitted
as an 8-bit byte with the high-order bit cleared to zero. Service as an 8-bit byte with the high-order bit cleared to zero. Service
extensions may modify this rule to permit transmission of full 8-bit extensions may modify this rule to permit transmission of full 8-bit
data bytes as part of the message body, or, if specifically designed data bytes as part of the message body, or, if specifically designed
to do so, in [[CREF216: [2821] JcK 20080406, remove double 'in', JcK to do so, in SMTP commands or responses.
20080504 ]] SMTP commands or responses.
Appendix B. Generating SMTP Commands from RFC 822 Header Fields Appendix B. Generating SMTP Commands from RFC 822 Header Fields
Some systems use an RFC 822 header section (only) in a mail Some systems use an RFC 822 header section (only) in a mail
submission protocol, or otherwise generate SMTP commands from RFC 822 submission protocol, or otherwise generate SMTP commands from RFC 822
header fields [[CREF217: [2821]Issue 27 20070423]] when such a header fields when such a message is handed to an MTA from a UA.
message is handed to an MTA from a UA. While the MTA-UA protocol is While the MTA-UA protocol is a private matter, not covered by any
a private matter, not covered by any Internet Standard, there are Internet Standard, there are problems with this approach. For
problems with this approach. For example, there have been repeated example, there have been repeated problems with proper handling of
problems with proper handling of "bcc" copies and redistribution "bcc" copies and redistribution lists when information that
lists when information that conceptually belongs to the mail envelope conceptually belongs to the mail envelope is not separated early in
is not separated early in processing from header field information processing from header field information (and kept separate).
(and kept separate).
It is recommended that the UA provide its initial ("submission It is recommended that the UA provide its initial ("submission
client") MTA with an envelope separate from the message itself. client") MTA with an envelope separate from the message itself.
However, if the envelope is not supplied, SMTP commands SHOULD be However, if the envelope is not supplied, SMTP commands SHOULD be
generated as follows: generated as follows:
1. Each recipient address from a TO, CC, or BCC header field SHOULD 1. Each recipient address from a TO, CC, or BCC header field SHOULD
be copied to a RCPT command (generating multiple message copies be copied to a RCPT command (generating multiple message copies
if that is required for queuing or delivery). This includes any if that is required for queuing or delivery). This includes any
addresses listed in a RFC 822 "group". Any BCC header fields addresses listed in a RFC 822 "group". Any BCC header fields
skipping to change at page 95, line 31 skipping to change at page 89, line 31
an Internet mailing list and is distributed into the foreign an Internet mailing list and is distributed into the foreign
environment using envelope information. When these messages are then environment using envelope information. When these messages are then
processed by a header-section-only remailer, loops back to the processed by a header-section-only remailer, loops back to the
Internet environment (and the mailing list) are almost inevitable. Internet environment (and the mailing list) are almost inevitable.
Appendix C. Source Routes Appendix C. Source Routes
Historically, the <reverse-path> was a reverse source routing list of Historically, the <reverse-path> was a reverse source routing list of
hosts and a source mailbox. The first host in the <reverse-path> was hosts and a source mailbox. The first host in the <reverse-path> was
historically the host sending the MAIL command; today, source routes historically the host sending the MAIL command; today, source routes
SHOULD NOT appear in the reverse-path. [[CREF218: [2821]Klensin- SHOULD NOT appear in the reverse-path. Similarly, the <forward-path>
Ellerman 20040422]] Similarly, the <forward-path> may be a source may be a source routing lists of hosts and a destination mailbox.
routing lists of hosts and a destination mailbox. However, in However, in general, the <forward-path> SHOULD contain only a mailbox
general, the <forward-path> SHOULD contain only a mailbox and domain and domain name, relying on the domain name system to supply routing
name, relying on the domain name system to supply routing information information if required. The use of source routes is deprecated (see
if required. The use of source routes is deprecated (see
Appendix F.2); while servers MUST be prepared to receive and handle Appendix F.2); while servers MUST be prepared to receive and handle
them as discussed in Section 3.3 and Appendix F.2, clients SHOULD NOT them as discussed in Section 3.3 and Appendix F.2, clients SHOULD NOT
transmit them and this section is included in the current transmit them and this section is included in the current
specification only to provide context. It has been modified somewhat specification only to provide context. It has been modified somewhat
from the material in RFC 821 to prevent server actions that might from the material in RFC 821 to prevent server actions that might
confuse clients or subsequent servers that do not expect a full confuse clients or subsequent servers that do not expect a full
source route implementation. [[CREF219: [2821] JcK 20040222 after source route implementation.
repeated comments from Frank Ellermann, see below. ]]
Historically, for relay purposes, the forward-path may have been a Historically, for relay purposes, the forward-path may have been a
source route of the form "@ONE,@TWO:JOE@THREE", where ONE, TWO, and source route of the form "@ONE,@TWO:JOE@THREE", where ONE, TWO, and
THREE MUST be fully-qualified domain names. This form was used to THREE MUST be fully-qualified domain names. This form was used to
emphasize the distinction between an address and a route. The emphasize the distinction between an address and a route. The
mailbox (here, JOE@THREE) is an absolute address, and the route is mailbox (here, JOE@THREE) is an absolute address, and the route is
information about how to get there. The two concepts should not be information about how to get there. The two concepts should not be
confused.[[CREF220: [5321bis]JcK 20090123: Tightened this and the confused.[[CREF26: [5321bis]JcK 20090123: Tightened this and the next
next paragraph to be clear that this doesn't authorize source route paragraph to be clear that this doesn't authorize source route use.]]
use.]]
If source routes are used contrary to requirements and If source routes are used contrary to requirements and
recommendations elsewhere in this specfiication, RFC 821 and the text recommendations elsewhere in this specfiication, RFC 821 and the text
below should be consulted for the mechanisms for constructing and below should be consulted for the mechanisms for constructing and
updating the forward-path. A server that is reached by means of a updating the forward-path. A server that is reached by means of a
source route (e.g., its domain name appears first in the list in the source route (e.g., its domain name appears first in the list in the
forward-path) MUST remove its domain name from any forward-paths in forward-path) MUST remove its domain name from any forward-paths in
which that domain name appears before forwarding the message and MAY which that domain name appears before forwarding the message and MAY
remove all other source routing information. The reverse-path SHOULD remove all other source routing information. The reverse-path SHOULD
NOT be updated by servers conforming to this specification. NOT be updated by servers conforming to this specification.
[[CREF221: [2821] Modified the previous sentence and deleted the
"SMTP server transforms... by moving..." paragraph as it makes no
sense in the context of deprecated source-paths. JcK 20040222 after
repeated comments from Frank Ellermann.]]
Notice that the forward-path and reverse-path appear in the SMTP Notice that the forward-path and reverse-path appear in the SMTP
commands and replies, but not necessarily in the message. That is, commands and replies, but not necessarily in the message. That is,
there is no need for these paths and especially this syntax to appear there is no need for these paths and especially this syntax to appear
in the "To:" , "From:", "CC:", etc. fields of the message header in the "To:" , "From:", "CC:", etc. fields of the message header
section. Conversely, SMTP servers MUST NOT derive final message section. Conversely, SMTP servers MUST NOT derive final message
routing information from message header fields.[[CREF222: routing information from message header fields.
[2821]"delivery" -> "routing", JcK 20070422]]
When the list of hosts is present despite the recommendations and When the list of hosts is present despite the recommendations and
requirements [[CREF223: [5321bis]JcK 20090123 "and requrements" requirements [[CREF27: [5321bis]JcK 20090123 "and requrements"
added]] above, it is a "reverse" source route and indicates that the added]] above, it is a "reverse" source route and indicates that the
mail was relayed through each host on the list (the first host in the mail was relayed through each host on the list (the first host in the
list was the most recent relay). This list is used as a source route list was the most recent relay). This list is used as a source route
to return non-delivery notices to the sender. If, contrary to the to return non-delivery notices to the sender. If, contrary to the
recommendations here, a relay host adds itself to the beginning of recommendations here, a relay host adds itself to the beginning of
the list, it MUST use its name as known in the transport environment the list, it MUST use its name as known in the transport environment
to which it is relaying the mail rather than that of the transport to which it is relaying the mail rather than that of the transport
environment from which the mail came (if they are different). Note environment from which the mail came (if they are different). Note
that a situation could easily arise in which some relay hosts add that a situation could easily arise in which some relay hosts add
their names to the reverse source route and others do not, generating their names to the reverse source route and others do not, generating
discontinuities in the routing list. This is another reason why discontinuities in the routing list. This is another reason why
servers needing to return a message SHOULD ignore the source route servers needing to return a message SHOULD ignore the source route
entirely and simply use the domain as specified in the Mailbox. entirely and simply use the domain as specified in the Mailbox.
[[CREF224: [2821] JcK 20070422]]
Appendix D. Scenarios Appendix D. Scenarios
This section presents complete scenarios of several types of SMTP This section presents complete scenarios of several types of SMTP
sessions. In the examples, "C:" indicates what is said by the SMTP sessions. In the examples, "C:" indicates what is said by the SMTP
client, and "S:" indicates what is said by the SMTP server. client, and "S:" indicates what is said by the SMTP server.
D.1. A Typical SMTP Transaction Scenario D.1. A Typical SMTP Transaction Scenario
This SMTP example shows mail sent by Smith at host bar.com, and to This SMTP example shows mail sent by Smith at host bar.com, and to
skipping to change at page 98, line 12 skipping to change at page 92, line 9
S: 550 No such user here S: 550 No such user here
C: RSET C: RSET
S: 250 OK S: 250 OK
C: QUIT C: QUIT
S: 221 foo.com Service closing transmission channel S: 221 foo.com Service closing transmission channel
D.3. Relayed Mail Scenario D.3. Relayed Mail Scenario
Step 1 -- Source Host to Relay Host Step 1 -- Source Host to Relay Host
[[CREF225: [2821]New intro paragraphs inserted and source routes The source host performs a DNS lookup on XYZ.COM (the destination
removed, Klensin/ Gulbrandsen 20070430, per Tony 20070503]] The
source host performs a DNS lookup on XYZ.COM (the destination
address) and finds DNS MX records specifying xyz.com as the best address) and finds DNS MX records specifying xyz.com as the best
preference and foo.com as a lower preference. It attempts to open a preference and foo.com as a lower preference. It attempts to open a
connection to xyz.com and fails. It then opens a connection to connection to xyz.com and fails. It then opens a connection to
foo.com, with the following dialogue: foo.com, with the following dialogue:
S: 220 foo.com Simple Mail Transfer Service Ready S: 220 foo.com Simple Mail Transfer Service Ready
C: EHLO bar.com C: EHLO bar.com
S: 250-foo.com greets bar.com S: 250-foo.com greets bar.com
S: 250-8BITMIME S: 250-8BITMIME
S: 250-SIZE S: 250-SIZE
skipping to change at page 98, line 47 skipping to change at page 92, line 42
C: C:
C: Bill: C: Bill:
C: The next meeting of the board of directors will be C: The next meeting of the board of directors will be
C: on Tuesday. C: on Tuesday.
C: John. C: John.
C: . C: .
S: 250 OK S: 250 OK
C: QUIT C: QUIT
S: 221 foo.com Service closing transmission channel S: 221 foo.com Service closing transmission channel
[[CREF226: [2821]Arnt suggests (20070430) addressing the Issue 25 NDN
issue by adding something, probably in the middle of the above: 'I'd
try to skirt the issue by saying "foo.com, having received the
message, verifies delivery to jones@xyz.com is permissible and
possible. foo.com now does a DNS lookup on xyz.com."' But it is wrong
-- by the time the 250 reply goes back after RCPT, it is all over.
And the only way to do a verification at that stage requires either
local tables of complete info about foo.com or keeping the connection
open in a rather different model than this example. I consider that
a showstopper. -JcK 20070504]]
Step 2 -- Relay Host to Destination Host Step 2 -- Relay Host to Destination Host
foo.com, having received the message, now does a DNS lookup on foo.com, having received the message, now does a DNS lookup on
xyz.com. It finds the same set of MX records, but cannot use the one xyz.com. It finds the same set of MX records, but cannot use the one
that points to itself (or to any other host as a worse preference). that points to itself (or to any other host as a worse preference).
It tries to open a connection to xyz.com itself and succeeds. Then It tries to open a connection to xyz.com itself and succeeds. Then
we have: we have:
S: 220 xyz.com Simple Mail Transfer Service Ready S: 220 xyz.com Simple Mail Transfer Service Ready
C: EHLO foo.com C: EHLO foo.com
skipping to change at page 100, line 9 skipping to change at page 93, line 43
C: EHLO bar.com C: EHLO bar.com
S: 250-foo.com greets bar.com S: 250-foo.com greets bar.com
S: 250-8BITMIME S: 250-8BITMIME
S: 250-SIZE S: 250-SIZE
S: 250-DSN S: 250-DSN
S: 250-VRFY S: 250-VRFY
S: 250 HELP S: 250 HELP
C: VRFY Crispin C: VRFY Crispin
S: 250 Mark Crispin <Admin.MRC@foo.com> S: 250 Mark Crispin <Admin.MRC@foo.com>
C: MAIL FROM:<EAK@bar.com> C: MAIL FROM:<EAK@bar.com>
[[CREF227: [2821]Tony 20080320]] S: 250 OK S: 250 OK
C: RCPT TO:<Admin.MRC@foo.com> C: RCPT TO:<Admin.MRC@foo.com>
S: 250 OK S: 250 OK
C: DATA C: DATA
S: 354 Start mail input; end with <CRLF>.<CRLF> S: 354 Start mail input; end with <CRLF>.<CRLF>
C: Blah blah blah... C: Blah blah blah...
C: ...etc. etc. etc. C: ...etc. etc. etc.
C: . C: .
S: 250 OK S: 250 OK
C: QUIT C: QUIT
S: 221 foo.com Service closing transmission channel S: 221 foo.com Service closing transmission channel
skipping to change at page 100, line 43 skipping to change at page 94, line 28
Appendix F. Deprecated Features of RFC 821 Appendix F. Deprecated Features of RFC 821
A few features of RFC 821 have proven to be problematic and SHOULD A few features of RFC 821 have proven to be problematic and SHOULD
NOT be used in Internet mail. Some of these features were deprecated NOT be used in Internet mail. Some of these features were deprecated
in RFC 2821 in 2001; source routing and two-digit years in dates were in RFC 2821 in 2001; source routing and two-digit years in dates were
deprecated by RFC 1123 in 1989. Of the domain literal forms, RFC deprecated by RFC 1123 in 1989. Of the domain literal forms, RFC
1123 required support only for the dotted decimal form. With the 1123 required support only for the dotted decimal form. With the
possible exception of old, hardware-embedded, applications, there is possible exception of old, hardware-embedded, applications, there is
no longer any excuse for these features to appear on the contemporary no longer any excuse for these features to appear on the contemporary
Internet. [[CREF228: [5321bis] (2821ter) 2821bis Last Call Comment]] Internet. [[CREF28: [5321bis] (2821ter) 2821bis Last Call Comment]]
F.1. TURN F.1. TURN
This command, described in RFC 821, raises important security issues This command, described in RFC 821, raises important security issues
since, in the absence of strong authentication of the host requesting since, in the absence of strong authentication of the host requesting
that the client and server switch roles, it can easily be used to that the client and server switch roles, it can easily be used to
divert mail from its correct destination. Its use is deprecated; divert mail from its correct destination. Its use is deprecated;
SMTP systems SHOULD NOT use it unless the server can authenticate the SMTP systems SHOULD NOT use it unless the server can authenticate the
client. client.
skipping to change at page 101, line 38 skipping to change at page 95, line 23
Clients SHOULD NOT utilize explicit source routing except under Clients SHOULD NOT utilize explicit source routing except under
unusual circumstances, such as debugging or potentially relaying unusual circumstances, such as debugging or potentially relaying
around firewall or mail system configuration errors. around firewall or mail system configuration errors.
F.3. HELO F.3. HELO
As discussed in Sections 3.1 and 4.1.1, EHLO SHOULD be used rather As discussed in Sections 3.1 and 4.1.1, EHLO SHOULD be used rather
than HELO when the server will accept the former. Servers MUST than HELO when the server will accept the former. Servers MUST
continue to accept and process HELO in order to support older continue to accept and process HELO in order to support older
clients. [[CREF229: [2821]Preferred->Should, etc. Issue 16 clients.
20070421]]
F.4. #-literals F.4. #-literals
RFC 821 provided for specifying an Internet address as a decimal RFC 821 provided for specifying an Internet address as a decimal
integer host number prefixed by a pound sign, "#". In practice, that integer host number prefixed by a pound sign, "#". In practice, that
form has been obsolete since the introduction of TCP/IP. It is form has been obsolete since the introduction of TCP/IP. It is
deprecated and MUST NOT be used. deprecated and MUST NOT be used.
F.5. Dates and Years F.5. Dates and Years
skipping to change at page 102, line 35 skipping to change at page 96, line 14
implementation model specified in RFC 821 MUST be used and the implementation model specified in RFC 821 MUST be used and the
command names MUST be published in the response to the EHLO command. command names MUST be published in the response to the EHLO command.
Appendix G. Change log for RFC 5321bis Appendix G. Change log for RFC 5321bis
[[RFC Editor: Please remove this section before publication.]] [[RFC Editor: Please remove this section before publication.]]
G.1. RFC 5321 Errata Summary G.1. RFC 5321 Errata Summary
This document addresses the following errata filed against RFC 5321 This document addresses the following errata filed against RFC 5321
since its publication in October 2008 [52]. [[CREF230: [[Note in since its publication in October 2008 [52]. [[CREF29: [[Note in
Draft: Items with comments below have not yet been resolved.]]]] Draft: Items with comments below have not yet been resolved.]]]]
1683 ABNF error. Section 4.4 1683 ABNF error. Section 4.4
4198 Description error. Section 4.2 4198 Description error. Section 4.2
2578 Syntax description error. Section 4.1.2 2578 Syntax description error. Section 4.1.2
1543 Wrong code in description Section 3.8 1543 Wrong code in description Section 3.8
4315 ABNF - IPv6 Section 4.1.3. [[CREF231: [5321bis]The IPv6 syntax 4315 ABNF - IPv6 Section 4.1.3. [[CREF30: [5321bis]The IPv6 syntax
has been adjusted since 5321 was published. See the rewritten has been adjusted since 5321 was published. See the rewritten
form and the comment in the section cited in the previous form and the comment in the section cited in the previous
sentence. The editor awaits instructions. See https://www.rfc- sentence. The editor awaits instructions. See https://www.rfc-
editor.org/errata/eid4315]] editor.org/errata/eid4315]]
5414 ABNF for Quoted-string Section 4.1.2 5414 ABNF for Quoted-string Section 4.1.2
1851 Location of text on unexpected close Section 4.1.1.5. 1851 Location of text on unexpected close Section 4.1.1.5.
[[CREF232: [5321bis]Matter of taste, editor seeks advice.]] [[CREF31: [5321bis]Matter of taste, editor seeks advice.]]
3447 Use of normative language (e.g., more "MUST"s), possible 3447 Use of normative language (e.g., more "MUST"s), possible
confusion in some sections Section 4.4. [[CREF233: [5321bis]As confusion in some sections Section 4.4. [[CREF32: [5321bis]As
Barry notes in his verifier comments on the erratum (see Barry notes in his verifier comments on the erratum (see
https://www.rfc-editor.org/errata/eid3447), the comments and https://www.rfc-editor.org/errata/eid3447), the comments and
suggestions here raise a number of interesting (and difficult) suggestions here raise a number of interesting (and difficult)
issues. One of the issues is that the core of RFCs 5321 (and issues. One of the issues is that the core of RFCs 5321 (and
2821) is text carried over from Jon Postel's RFC 821, a document 2821) is text carried over from Jon Postel's RFC 821, a document
that was not only written in a different style than the IETF uses that was not only written in a different style than the IETF uses
today but that was written at a time when no one had dreamt of RFC today but that was written at a time when no one had dreamt of RFC
2119 or even the IETF itself. It appears to me that trying to 2119 or even the IETF itself. It appears to me that trying to
patch that style might easily result in a document that is harder patch that style might easily result in a document that is harder
to read as well as being error prone. If we want to get the to read as well as being error prone. If we want to get the
document entirely into contemporary style, we really should bite document entirely into contemporary style, we really should bite
the bullet and do a complete rewrite. To respond to a different the bullet and do a complete rewrite. To respond to a different
point in Barry's discussion, I think an explicit statement that point in Barry's discussion, I think an explicit statement that
5321/5322 and their predecessors differ in places and why would be 5321/5322 and their predecessors differ in places and why would be
helpful. Text, and suggestions about where to put it, are helpful. Text, and suggestions about where to put it, are
solicited. A list of differences might be a good idea too, but solicited. A list of differences might be a good idea too, but
getting it right might be more work than there is available energy getting it right might be more work than there is available energy
to do correctly. ]] to do correctly. ]]
5711 Missing leading spaces in example Appendix D.3. [[CREF234: 5711 Missing leading spaces in example Appendix D.3. [[CREF33:
[5321bis]Well, this is interesting because the XML is correct and [5321bis]Well, this is interesting because the XML is correct and
the spaces are there, embedded in artwork. So either the XML2RFC the spaces are there, embedded in artwork. So either the XML2RFC
processor at the time took those leading spaces out or the RFC processor at the time took those leading spaces out or the RFC
Editor improved on the document and the change was not caught in Editor improved on the document and the change was not caught in
AUTH48, perhaps because rfcdiff ignores white space. We just need AUTH48, perhaps because rfcdiff ignores white space. We just need
to watch for future iterations. ]] to watch for future iterations. ]]
[[CREF235: [5321bis]Note that rejected errata have _not_ been [[CREF34: [5321bis]Note that rejected errata have _not_ been reviewed
reviewed to see if they contain anything useful that should be to see if they contain anything useful that should be discussed again
discussed again with the possibility of rethinking and changing text. with the possibility of rethinking and changing text. Volunteers
Volunteers sought.]] sought.]]
G.2. Changes from RFC 5321 (published October 2008) to the initial G.2. Changes from RFC 5321 (published October 2008) to the initial
(-00) version of this draft (-00) version of this draft
o Acknowledgments section (Section 9) trimmed back for new document. o Acknowledgments section (Section 9) trimmed back for new document.
o Introductory paragraph to Appendix F extended to make it clear o Introductory paragraph to Appendix F extended to make it clear
that these features were deprecated a long time ago and really that these features were deprecated a long time ago and really
should not be in use any more. should not be in use any more.
skipping to change at page 105, line 5 skipping to change at page 98, line 34
comparison to 5321 in this Appendix. The entire Appendix will, of comparison to 5321 in this Appendix. The entire Appendix will, of
course, disappear at the time of RFC publication unless someone course, disappear at the time of RFC publication unless someone
wants to make a strong case for retaining it. wants to make a strong case for retaining it.
o Rationalized CREFs to 2821, 5321, 5321bis etc.; added note to o Rationalized CREFs to 2821, 5321, 5321bis etc.; added note to
readers below the Abstract. readers below the Abstract.
o Temporarily added a "Note on Reading This Working Draft" after the o Temporarily added a "Note on Reading This Working Draft" after the
Abstract. Abstract.
G.3. Changes Among Versions of Rfc5321Bis
G.3.1. Changes from draft-klensin-rfc5321bis-00 (posted 2012-12-02) to
-01
Substantively, these two versions differ only by suppression of the
CREF and other discussion associated with the evolution from RFC 2821
to RFC 5321. That change includes an update to the document's Note
to Readers, the date, the file name, and the addition of this change
log subsection.
Index Index
A A
Argument Syntax Argument Syntax
A-d-l 44 A-d-l 41
Additional-Registered-Clauses 67 Additional-Registered-Clauses 62
address-literal 45 address-literal 42
Addtl-Link 67 Addtl-Link 62
Addtl-Protocol 67 Addtl-Protocol 62
Argument 44 Argument 42
At-domain 44 At-domain 41
Atom 45 Atom 42
By-domain 66 By-domain 61
dcontent 47 dcontent 44
Domain 45 Domain 42
Dot-string 45 Dot-string 42
esmtp-keyword 44 esmtp-keyword 41
esmtp-param 44 esmtp-param 41
esmtp-value 44 esmtp-value 42
Extended-Domain 66 Extended-Domain 61
For 66 For 62
Forward-Path 44 Forward-Path 41
From-domain 66 From-domain 61
General-address-literal 47 General-address-literal 44
Greeting 51 Greeting 47
h16 48 h16 44
ID 66 ID 62
IPv4-address-literal 47 IPv4-address-literal 44
IPv6-addr 47 IPv6-addr 44
IPv6-address-literal 47 IPv6-address-literal 44
Keyword 44 Keyword 42
Ldh-str 45 Ldh-str 42
Let-dig 45 Let-dig 42
Link 67 Link 62
Local-part 45 Local-part 42
ls32 47 ls32 44
Mail-parameters 44 Mail-parameters 41
Mailbox 45 Mailbox 42
Opt-info 66 Opt-info 62
Path 44 Path 41
Protocol 67 Protocol 62
QcontentSMTP 45 QcontentSMTP 42
qtextSMTP 45 qtextSMTP 42
quoted-pairSMTP 45 quoted-pairSMTP 42
Quoted-string 45 Quoted-string 42
Rcpt-parameters 44 Rcpt-parameters 41
Reply-code 51 Reply-code 47
Reply-line 51 Reply-line 47
Return-path-line 65 Return-path-line 61
Reverse-Path 44 Reverse-Path 41
Snum 47 Snum 44
Stamp 66 Stamp 61
Standardized-tag 47 Standardized-tag 44
String 45 String 42
sub-domain 45 sub-domain 42
TCP-info 66 TCP-info 62
textstring 51 textstring 47
Time-stamp-line 65 Time-stamp-line 61
Via 66 Via 62
With 66 With 62
C C
Command Syntax Command Syntax
data 40 data 38
expn 42 expn 39
help 42 help 40
mail 37 mail 35
noop 43 noop 40
quit 43 quit 40
rcpt 39 rcpt 37
rset 41 rset 39
vrfy 41 vrfy 39
Author's Address Author's Address
John C. Klensin John C. Klensin
1770 Massachusetts Ave, Suite 322 1770 Massachusetts Ave, Suite 322
Cambridge, MA 02140 Cambridge, MA 02140
USA USA
EMail: john-ietf@jck.com EMail: john-ietf@jck.com
 End of changes. 212 change blocks. 
956 lines changed or deleted 664 lines changed or added

This html diff was produced by rfcdiff 1.48. The latest version is available from http://tools.ietf.org/tools/rfcdiff/