As per Relevance of the word standard, we have this rfc below:











Network Working Group J. Klensin,
Request for Comments: 2821 AT&T
Obsoletes: 821, 974, 1869 April 2001
Updates: 1123
Category: Standards


Simple Mail Transfer

Status of this

This document specifies an Internet standards track protocol for
Internet community, and requests discussion and suggestions
improvements. Please refer to the current edition of the "
Official Protocol Standards" (STD 1) for the standardization
and status of this protocol. Distribution of this memo is unlimited

Copyright

Copyright (C) The Internet Society (2001). All Rights Reserved



This document is a self-contained specification of the basic
for the Internet electronic mail transport. It consolidates,
and clarifies, but doesn't add new or change existing
of the following

- the original SMTP (Simple Mail Transfer Protocol) specification
RFC 821 [30],

- domain name system requirements and implications for
transport from RFC 1035 [22] and RFC 974 [27],

- the clarifications and applicability statements in RFC 1123 [2],


- material drawn from the SMTP Extension mechanisms [19].

It obsoletes RFC 821, RFC 974, and updates RFC 1123 (replaces
mail transport materials of RFC 1123). However, RFC 821
some features that were not in significant use in the Internet by
mid-1990s and (in appendices) some additional transport models
Those sections are omitted here in the interest of clarity
brevity; readers needing them should refer to RFC 821.






Klensin Standards Track [Page 1]

RFC 2821 Simple Mail Transfer Protocol April 2001


It also includes some additional material from RFC 1123 that
amplification. This material has been identified in multiple ways
mostly by tracking flaming on various lists and newsgroups
problems of unusual readings or interpretations that have appeared
the SMTP extensions have been deployed. Where this
moves beyond consolidation and actually differs from
documents, it supersedes them technically as well as textually

Although SMTP was designed as a mail transport and delivery protocol
this specification also contains information that is important to
use as a 'mail submission' protocol, as recommended for POP [3, 26]
and IMAP [6]. Additional submission issues are discussed in RFC 2476
[15].

Section 2.3 provides definitions of terms specific to this document
Except when the historical terminology is necessary for clarity,
document uses the current 'client' and 'server' terminology
identify the sending and receiving SMTP processes, respectively

A companion document [32] discusses message headers, message
and formats and structures for them, and their relationship

Table of

1. Introduction .................................................. 4
2. The SMTP Model ................................................ 5
2.1 Basic Structure .............................................. 5
2.2 The Extension Model .......................................... 7
2.2.1 Background ................................................. 7
2.2.2 Definition and Registration of Extensions .................. 8
2.3 Terminology .................................................. 9
2.3.1 Mail Objects ............................................... 10
2.3.2 Senders and Receivers ...................................... 10
2.3.3 Mail Agents and Message Stores ............................. 10
2.3.4 Host ....................................................... 11
2.3.5 Domain ..................................................... 11
2.3.6 Buffer and State Table ..................................... 11
2.3.7 Lines ...................................................... 12
2.3.8 Originator, Delivery, Relay, and Gateway Systems ........... 12
2.3.9 Message Content and Mail Data .............................. 13
2.3.10 Mailbox and Address ....................................... 13
2.3.11 Reply ..................................................... 13
2.4 General Syntax Principles and Transaction Model .............. 13
3. The SMTP Procedures: An Overview .............................. 15
3.1 Session Initiation ........................................... 15
3.2 Client Initiation ............................................ 16
3.3 Mail Transactions ............................................ 16
3.4 Forwarding for Address Correction or Updating ................ 19



Klensin Standards Track [Page 2]

RFC 2821 Simple Mail Transfer Protocol April 2001


3.5 Commands for Debugging Addresses ............................. 20
3.5.1 Overview ................................................... 20
3.5.2 VRFY Normal Response ....................................... 22
3.5.3 Meaning of VRFY or EXPN Success Response ................... 22
3.5.4 Semantics and Applications of EXPN ......................... 23
3.6 Domains ...................................................... 23
3.7 Relaying ..................................................... 24
3.8 Mail Gatewaying .............................................. 25
3.8.1 Header Fields in Gatewaying ................................ 26
3.8.2 Received Lines in Gatewaying ............................... 26
3.8.3 Addresses in Gatewaying .................................... 26
3.8.4 Other Header Fields in Gatewaying .......................... 27
3.8.5 Envelopes in Gatewaying .................................... 27
3.9 Terminating Sessions and Connections ......................... 27
3.10 Mailing Lists and Aliases ................................... 28
3.10.1 Alias ..................................................... 28
3.10.2 List ...................................................... 28
4. The SMTP Specifications ....................................... 29
4.1 SMTP Commands ................................................ 29
4.1.1 Command Semantics and Syntax ............................... 29
4.1.1.1 Extended HELLO (EHLO) or HELLO (HELO) ................... 29
4.1.1.2 MAIL (MAIL) .............................................. 31
4.1.1.3 RECIPIENT (RCPT) ......................................... 31
4.1.1.4 DATA (DATA) .............................................. 33
4.1.1.5 RESET (RSET) ............................................. 34
4.1.1.6 VERIFY (VRFY) ............................................ 35
4.1.1.7 EXPAND (EXPN) ............................................ 35
4.1.1.8 HELP (HELP) .............................................. 35
4.1.1.9 NOOP (NOOP) .............................................. 35
4.1.1.10 QUIT (QUIT) ............................................. 36
4.1.2 Command Argument Syntax .................................... 36
4.1.3 Address Literals ........................................... 38
4.1.4 Order of Commands .......................................... 39
4.1.5 Private-use Commands ....................................... 40
4.2 SMTP Replies ................................................ 40
4.2.1 Reply Code Severities and Theory ........................... 42
4.2.2 Reply Codes by Function Groups ............................. 44
4.2.3 Reply Codes in Numeric Order .............................. 45
4.2.4 Reply Code 502 ............................................. 46
4.2.5 Reply Codes After DATA and the Subsequent . .... 46
4.3 Sequencing of Commands and Replies ........................... 47
4.3.1 Sequencing Overview ........................................ 47
4.3.2 Command-Reply Sequences .................................... 48
4.4 Trace Information ............................................ 49
4.5 Additional Implementation Issues ............................. 53
4.5.1 Minimum Implementation ..................................... 53
4.5.2 Transparency ............................................... 53
4.5.3 Sizes and Timeouts ......................................... 54



Klensin Standards Track [Page 3]

RFC 2821 Simple Mail Transfer Protocol April 2001


4.5.3.1 Size limits and minimums ................................. 54
4.5.3.2 Timeouts ................................................. 56
4.5.4 Retry Strategies ........................................... 57
4.5.4.1 Sending Strategy ......................................... 58
4.5.4.2 Receiving Strategy ....................................... 59
4.5.5 Messages with a null reverse-path .......................... 59
5. Address Resolution and Mail Handling .......................... 60
6. Problem Detection and Handling ................................ 62
6.1 Reliable Delivery and Replies by Email ....................... 62
6.2 Loop Detection ............................................... 63
6.3 Compensating for Irregularities .............................. 63
7. Security Considerations ....................................... 64
7.1 Mail Security and Spoofing ................................... 64
7.2 "Blind" Copies ............................................... 65
7.3 VRFY, EXPN, and Security ..................................... 65
7.4 Information Disclosure in Announcements ...................... 66
7.5 Information Disclosure in Trace Fields ....................... 66
7.6 Information Disclosure in Message Forwarding ................. 67
7.7 Scope of Operation of SMTP Servers ........................... 67
8. IANA Considerations ........................................... 67
9. References .................................................... 68
10. Editor's Address ............................................. 70
11. Acknowledgments .............................................. 70
Appendices ....................................................... 71
A. TCP Transport Service ......................................... 71
B. Generating SMTP Commands from RFC 822 Headers ................. 71
C. Source Routes ................................................. 72
D. Scenarios ..................................................... 73
E. Other Gateway Issues .......................................... 76
F. Deprecated Features of RFC 821 ................................ 76
Full Copyright Statement ......................................... 79

1.

The objective of the Simple Mail Transfer Protocol (SMTP) is
transfer mail reliably and efficiently

SMTP is independent of the particular transmission subsystem
requires only a reliable ordered data stream channel. While
document specifically discusses transport over TCP, other
are possible. Appendices to RFC 821 describe some of them

An important feature of SMTP is its capability to transport
across networks, usually referred to as "SMTP mail relaying" (
section 3.8). A network consists of the mutually-TCP-
hosts on the public Internet, the mutually-TCP-accessible hosts on
firewall-isolated TCP/IP Intranet, or hosts in some other LAN or
environment utilizing a non-TCP transport-level protocol.



Klensin Standards Track [Page 4]

RFC 2821 Simple Mail Transfer Protocol April 2001


SMTP, a process can transfer mail to another process on the
network or to some other network via a relay or gateway
accessible to both networks

In this way, a mail message may pass through a number of
relay or gateway hosts on its path from sender to ultimate recipient
The Mail eXchanger mechanisms of the domain name system [22, 27] (
section 5 of this document) are used to identify the
next-hop destination for a message being transported

2. The SMTP

2.1 Basic

The SMTP design can be pictured as

+----------+ +----------+
+------+ | | | |
| User |<-->| | SMTP | |
+------+ | Client- |Commands/Replies| Server- |
+------+ | SMTP |<-------------->| SMTP | +------+
| File |<-->| | and Mail | |<-->| File |
|System| | | | | |System
+------+ +----------+ +----------+ +------+
SMTP client SMTP

When an SMTP client has a message to transmit, it establishes a two
way transmission channel to an SMTP server. The responsibility of
SMTP client is to transfer mail messages to one or more SMTP servers
or report its failure to do so

The means by which a mail message is presented to an SMTP client,
how that client determines the domain name(s) to which mail
are to be transferred is a local matter, and is not addressed by
document. In some cases, the domain name(s) transferred to,
determined by, an SMTP client will identify the final destination(s
of the mail message. In other cases, common with SMTP
associated with implementations of the POP [3, 26] or IMAP [6]
protocols, or when the SMTP client is inside an isolated
service environment, the domain name determined will identify
intermediate destination through which all mail messages are to
relayed. SMTP clients that transfer all traffic, regardless of
target domain names associated with the individual messages, or
do not maintain queues for retrying message transmissions
initially cannot be completed, may otherwise conform to
specification but are not considered fully-capable. Fully-
SMTP implementations, including the relays used by these less




Klensin Standards Track [Page 5]

RFC 2821 Simple Mail Transfer Protocol April 2001


ones, and their destinations, are expected to support all of
queuing, retrying, and alternate address functions discussed in
specification

The means by which an SMTP client, once it has determined a
domain name, determines the identity of an SMTP server to which
copy of a message is to be transferred, and then performs
transfer, is covered by this document. To effect a mail transfer
an SMTP server, an SMTP client establishes a two-way
channel to that SMTP server. An SMTP client determines the
of an appropriate host running an SMTP server by resolving
destination domain name to either an intermediate Mail eXchanger
or a final target host

An SMTP server may be either the ultimate destination or
intermediate "relay" (that is, it may assume the role of an
client after receiving the message) or "gateway" (that is, it
transport the message further using some protocol other than SMTP).
SMTP commands are generated by the SMTP client and sent to the
server. SMTP replies are sent from the SMTP server to the
client in response to the commands

In other words, message transfer can occur in a single
between the original SMTP-sender and the final SMTP-recipient, or
occur in a series of hops through intermediary systems. In
case, a formal handoff of responsibility for the message occurs:
protocol requires that a server accept responsibility for
delivering a message or properly reporting the failure to do so

Once the transmission channel is established and initial
completed, the SMTP client normally initiates a mail transaction
Such a transaction consists of a series of commands to specify
originator and destination of the mail and transmission of
message content (including any headers or other structure) itself
When the same message is sent to multiple recipients, this
encourages the transmission of only one copy of the data for
recipients at the same destination (or intermediate relay) host

The server responds to each command with a reply; replies
indicate that the command was accepted, that additional commands
expected, or that a temporary or permanent error condition exists
Commands specifying the sender or recipients may include server
permitted SMTP service extension requests as discussed in
2.2. The dialog is purposely lock-step, one-at-a-time, although
can be modified by mutually-agreed extension requests such as
pipelining [13].





Klensin Standards Track [Page 6]

RFC 2821 Simple Mail Transfer Protocol April 2001


Once a given mail message has been transmitted, the client may
request that the connection be shut down or may initiate other
transactions. In addition, an SMTP client may use a connection to
SMTP server for ancillary services such as verification of
addresses or retrieval of mailing list subscriber addresses

As suggested above, this protocol provides mechanisms for
transmission of mail. This transmission normally occurs
from the sending user's host to the receiving user's host when
two hosts are connected to the same transport service. When they
not connected to the same transport service, transmission occurs
one or more relay SMTP servers. An intermediate host that acts
either an SMTP relay or as a gateway into some other
environment is usually selected through the use of the domain
service (DNS) Mail eXchanger mechanism

Usually, intermediate hosts are determined via the DNS MX record,
by explicit "source" routing (see section 5 and appendices C
F.2).

2.2 The Extension

2.2.1

In an effort that started in 1990, approximately a decade after
821 was completed, the protocol was modified with a "
extensions" model that permits the client and server to agree
utilize shared functionality beyond the original SMTP requirements
The SMTP extension mechanism defines a means whereby an extended
client and server may recognize each other, and the server can
the client as to the service extensions that it supports

Contemporary SMTP implementations MUST support the basic
mechanisms. For instance, servers MUST support the EHLO command
if they do not implement any specific extensions and clients
preferentially utilize EHLO rather than HELO. (However,
compatibility with older conforming implementations, SMTP clients
servers MUST support the original HELO mechanisms as a fallback.)
Unless the different characteristics of HELO must be identified
interoperability purposes, this document discusses only EHLO

SMTP is widely deployed and high-quality implementations have
to be very robust. However, the Internet community now
some services to be important that were not anticipated when
protocol was first designed. If support for those services is to
added, it must be done in a way that permits older implementations
continue working acceptably. The extension framework consists of




Klensin Standards Track [Page 7]

RFC 2821 Simple Mail Transfer Protocol April 2001


- The SMTP command EHLO, superseding the earlier HELO

- a registry of SMTP service extensions

- additional parameters to the SMTP MAIL and RCPT commands,

- optional replacements for commands defined in this protocol,
as for DATA in non-ASCII transmissions [33].

SMTP's strength comes primarily from its simplicity. Experience
many protocols has shown that protocols with few options tend
ubiquity, whereas protocols with many options tend towards obscurity

Each and every extension, regardless of its benefits, must
carefully scrutinized with respect to its implementation, deployment
and interoperability costs. In many cases, the cost of extending
SMTP service will likely outweigh the benefit

2.2.2 Definition and Registration of

The IANA maintains a registry of SMTP service extensions.
corresponding EHLO keyword value is associated with each extension
Each service extension registered with the IANA must be defined in
formal standards-track or IESG-approved experimental
document. The definition must include

- the textual name of the SMTP service extension

- the EHLO keyword value associated with the extension

- the syntax and possible values of parameters associated with
EHLO keyword value

- any additional SMTP verbs associated with the
(additional verbs will usually be, but are not required to be,
same as the EHLO keyword value);

- any new parameters the extension associates with the MAIL or
verbs

- a description of how support for the extension affects
behavior of a server and client SMTP; and

- the increment by which the extension is increasing the
length of the commands MAIL and/or RCPT, over that specified
this standard





Klensin Standards Track [Page 8]

RFC 2821 Simple Mail Transfer Protocol April 2001


In addition, any EHLO keyword value starting with an upper or
case "X" refers to a local SMTP service extension used
through bilateral agreement. Keywords beginning with "X" MUST NOT
used in a registered service extension. Conversely, keyword
presented in the EHLO response that do not begin with "X"
correspond to a standard, standards-track, or IESG-
experimental SMTP service extension registered with IANA.
conforming server MUST NOT offer non-"X"-prefixed keyword values
are not described in a registered extension

Additional verbs and parameter names are bound by the same rules
EHLO keywords; specifically, verbs beginning with "X" are
extensions that may not be registered or standardized. Conversely
verbs not beginning with "X" must always be registered

2.3

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in
document are to be interpreted as described below

1. MUST This word, or the terms "REQUIRED" or "SHALL", mean
the definition is an absolute requirement of the specification

2. MUST NOT This phrase, or the phrase "SHALL NOT", mean that
definition is an absolute prohibition of the specification

3. SHOULD This word, or the adjective "RECOMMENDED", mean
there may exist valid reasons in particular circumstances
ignore a particular item, but the full implications must
understood and carefully weighed before choosing a
course

4. SHOULD NOT This phrase, or the phrase "NOT RECOMMENDED"
that there may exist valid reasons in particular
when the particular behavior is acceptable or even useful, but
full implications should be understood and the case
weighed before implementing any behavior described with
label

5. MAY This word, or the adjective "OPTIONAL", mean that an item
truly optional. One vendor may choose to include the item
a particular marketplace requires it or because the vendor
that it enhances the product while another vendor may omit
same item. An implementation which does not include a
option MUST be prepared to interoperate with
implementation which does include the option, though perhaps
reduced functionality. In the same vein an implementation



Klensin Standards Track [Page 9]

RFC 2821 Simple Mail Transfer Protocol April 2001


does include a particular option MUST be prepared to
with another implementation which does not include the
(except, of course, for the feature the option provides.)

2.3.1 Mail

SMTP transports a mail object. A mail object contains an
and content

The SMTP envelope is sent as a series of SMTP protocol
(described in section 3). It consists of an originator address (
which error reports should be directed); one or more
addresses; and optional protocol extension material. Historically
variations on the recipient address specification command (RCPT TO
could be used to specify alternate delivery modes, such as
display; those variations have now been deprecated (see appendix F
section F.6).

The SMTP content is sent in the SMTP DATA protocol unit and has
parts: the headers and the body. If the content conforms to
contemporary standards, the headers form a collection of field/
pairs structured as in the message format specification [32];
body, if structured, is defined according to MIME [12]. The
is textual in nature, expressed using the US-ASCII repertoire [1].
Although SMTP extensions (such as "8BITMIME" [20]) may relax
restriction for the content body, the content headers are
encoded using the US-ASCII repertoire. A MIME extension [23]
an algorithm for representing header values outside the US-
repertoire, while still encoding them using the US-ASCII repertoire

2.3.2 Senders and

In RFC 821, the two hosts participating in an SMTP transaction
described as the "SMTP-sender" and "SMTP-receiver". This
has been changed to reflect current industry terminology and
refers to them as the "SMTP client" (or sometimes just "the client")
and "SMTP server" (or just "the server"), respectively. Since
given host may act both as server and client in a relay situation
"receiver" and "sender" terminology is still used where needed
clarity

2.3.3 Mail Agents and Message

Additional mail system terminology became common after RFC 821
published and, where convenient, is used in this specification.
particular, SMTP servers and clients provide a mail transport
and therefore act as "Mail Transfer Agents" (MTAs). "Mail
Agents" (MUAs or UAs) are normally thought of as the sources



Klensin Standards Track [Page 10]

RFC 2821 Simple Mail Transfer Protocol April 2001


targets of mail. At the source, an MUA might collect mail to
transmitted from a user and hand it off to an MTA; the
("delivery") MTA would be thought of as handing the mail off to
MUA (or at least transferring responsibility to it, e.g.,
depositing the message in a "message store"). However, while
terms are used with at least the appearance of great precision
other environments, the implied boundaries between MUAs and
often do not accurately match common, and conforming, practices
Internet mail. Hence, the reader should be cautious about
the strong relationships and responsibilities that might be
if these terms were used elsewhere

2.3.4

For the purposes of this specification, a host is a computer
attached to the Internet (or, in some cases, to a private TCP/
network) and supporting the SMTP protocol. Hosts are known by
(see "domain"); identifying them by numerical address is discouraged

2.3.5

A domain (or domain name) consists of one or more dot-
components. These components ("labels" in DNS terminology [22])
restricted for SMTP purposes to consist of a sequence of letters
digits, and hyphens drawn from the ASCII character set [1].
names are used as names of hosts and of other entities in the
name hierarchy. For example, a domain may refer to an alias (
of a CNAME RR) or the label of Mail eXchanger records to be used
deliver mail instead of representing a host name. See [22]
section 5 of this specification

The domain name, as described in this document and in [22], is
entire, fully-qualified name (often referred to as an "FQDN").
domain name that is not in FQDN form is no more than a local alias
Local aliases MUST NOT appear in any SMTP transaction

2.3.6 Buffer and State

SMTP sessions are stateful, with both parties carefully maintaining
common view of the current state. In this document we model
state by a virtual "buffer" and a "state table" on the server
may be used by the client to, for example, "clear the buffer"
"reset the state table," causing the information in the buffer to
discarded and the state to be returned to some previous state







Klensin Standards Track [Page 11]

RFC 2821 Simple Mail Transfer Protocol April 2001


2.3.7

SMTP commands and, unless altered by a service extension,
data, are transmitted in "lines". Lines consist of zero or more
characters terminated by the sequence ASCII character "CR" (hex
0D) followed immediately by ASCII character "LF" (hex value 0A).
This termination sequence is denoted as in this document
Conforming implementations MUST NOT recognize or generate any
character or character sequence as a line terminator. Limits MAY
imposed on line lengths by servers (see section 4.5.3).

In addition, the appearance of "bare" "CR" or "LF" characters in
(i.e., either without the other) has a long history of
problems in mail implementations and applications that use the
system as a tool. SMTP client implementations MUST NOT
these characters except when they are intended as line
and then MUST, as indicated above, transmit them only as a sequence

2.3.8 Originator, Delivery, Relay, and Gateway

This specification makes a distinction among four types of
systems, based on the role those systems play in
electronic mail. An "originating" system (sometimes called an
originator) introduces mail into the Internet or, more generally
into a transport service environment. A "delivery" SMTP system
one that receives mail from a transport service environment
passes it to a mail user agent or deposits it in a message
which a mail user agent is expected to subsequently access.
"relay" SMTP system (usually referred to just as a "relay")
mail from an SMTP client and transmits it, without modification
the message data other than adding trace information, to another
server for further relaying or for delivery

A "gateway" SMTP system (usually referred to just as a "gateway")
receives mail from a client system in one transport environment
transmits it to a server system in another transport environment
Differences in protocols or message semantics between the
environments on either side of a gateway may require that the
system perform transformations to the message that are not
to SMTP relay systems. For the purposes of this specification
firewalls that rewrite addresses should be considered as gateways
even if SMTP is used on both sides of them (see [11]).








Klensin Standards Track [Page 12]

RFC 2821 Simple Mail Transfer Protocol April 2001


2.3.9 Message Content and Mail

The terms "message content" and "mail data" are used
in this document to describe the material transmitted after the
command is accepted and before the end of data indication
transmitted. Message content includes message headers and
possibly-structured message body. The MIME specification [12]
provides the standard mechanisms for structured message bodies

2.3.10 Mailbox and

As used in this specification, an "address" is a character
that identifies a user to whom mail will be sent or a location
which mail will be deposited. The term "mailbox" refers to
depository. The two terms are typically used interchangeably
the distinction between the location in which mail is placed (
mailbox) and a reference to it (the address) is important.
address normally consists of user and domain specifications.
standard mailbox naming convention is defined to be "local
part@domain": contemporary usage permits a much broader set
applications than simple "user names". Consequently, and due to
long history of problems when intermediate hosts have attempted
optimize transport by modifying them, the local-part MUST
interpreted and assigned semantics only by the host specified in
domain part of the address

2.3.11

An SMTP reply is an acknowledgment (positive or negative) sent
receiver to sender via the transmission channel in response to
command. The general form of a reply is a numeric completion
(indicating failure or success) usually followed by a text string
The codes are for use by programs and the text is usually
for human users. Recent work [34] has specified further
of the reply strings, including the use of supplemental and
specific completion codes

2.4 General Syntax Principles and Transaction

SMTP commands and replies have a rigid syntax. All commands
with a command verb. All Replies begin with a three digit
code. In some commands and replies, arguments MUST follow the
or reply code. Some commands do not accept arguments (after
verb), and some reply codes are followed, sometimes optionally,
free form text. In both cases, where text appears, it is
from the verb or reply code by a space character.
definitions of commands and replies appear in section 4.




Klensin Standards Track [Page 13]

RFC 2821 Simple Mail Transfer Protocol April 2001


Verbs and argument values (e.g., "TO:" or "to:" in the RCPT
and extension name keywords) are not case sensitive, with the
exception in this specification of a mailbox local-part (
Extensions may explicitly specify case-sensitive elements). That is
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
mixture of upper and lower case with no impact on its meaning.
is NOT true of a mailbox local-part. The local-part of a
MUST BE treated as case sensitive. Therefore, SMTP
MUST take care to preserve the case of mailbox local-parts.
domains are not case sensitive. In particular, for some hosts
user "smith" is different from the user "Smith". However,
the case sensitivity of mailbox local-parts impedes
and is discouraged

A few SMTP servers, in violation of this specification (and RFC 821)
require that command verbs be encoded by clients in upper case
Implementations MAY wish to employ this encoding to accommodate
servers

The argument field consists of a variable length character
ending with the end of the line, i.e., with the character
. The receiver will take no action until this sequence
received

The syntax for each command is shown with the discussion of
command. Common elements and parameters are shown in section 4.1.2.

Commands and replies are composed of characters from the
character set [1]. When the transport service provides an 8-bit
(octet) transmission channel, each 7-bit character is
right justified in an octet with the high order bit cleared to zero
More specifically, the unextended SMTP service provides seven
transport only. An originating SMTP client which has
successfully negotiated an appropriate extension with a
server MUST NOT transmit messages with information in the high-
bit of octets. If such messages are transmitted in violation of
rule, receiving SMTP servers MAY clear the high-order bit or
the message as invalid. In general, a relay SMTP SHOULD assume
the message content it has received is valid and, assuming that
envelope permits doing so, relay it without inspecting that content
Of course, if the content is mislabeled and the data path
accept the actual content, this may result in ultimate delivery of
severely garbled message to the recipient. Delivery SMTP systems
reject ("bounce") such messages rather than deliver them. No
SMTP system is permitted to send envelope commands in any





Klensin Standards Track [Page 14]

RFC 2821 Simple Mail Transfer Protocol April 2001


set other than US-ASCII; receiving systems SHOULD reject
commands, normally using "500 syntax error - invalid character
replies

Eight-bit message content transmission MAY be requested of the
by a client using extended SMTP facilities, notably the "8BITMIME
extension [20]. 8BITMIME SHOULD be supported by SMTP servers
However, it MUST not be construed as authorization to
unrestricted eight bit material. 8BITMIME MUST NOT be requested
senders for material with the high bit on that is not in MIME
with an appropriate content-transfer encoding; servers MAY
such messages

The metalinguistic notation used in this document corresponds to
"Augmented BNF" used in other Internet mail system documents.
reader who is not familiar with that syntax should consult the
specification [8]. Metalanguage terms used in running text
surrounded by pointed brackets (e.g., ) for clarity

3. The SMTP Procedures: An

This section contains descriptions of the procedures used in SMTP
session initiation, the mail transaction, forwarding mail,
mailbox names and expanding mailing lists, and the opening
closing exchanges. Comments on relaying, a note on mail domains,
a discussion of changing roles are included at the end of
section. Several complete scenarios are presented in appendix D

3.1 Session

An SMTP session is initiated when a client opens a connection to
server and the server responds with an opening message

SMTP server implementations MAY include identification of
software and version information in the connection greeting
after the 220 code, a practice that permits more efficient
and repair of any problems. Implementations MAY make provision
SMTP servers to disable the software and version announcement
it causes security concerns. While some systems also identify
contact point for mail problems, this is not a substitute
maintaining the required "postmaster" address (see section 4.5.1).

The SMTP protocol allows a server to formally reject a
while still allowing the initial connection as follows: a 554
response MAY be given in the initial connection opening
instead of the 220. A server taking this approach MUST still
for the client to send a QUIT (see section 4.1.1.10) before
the connection and SHOULD respond to any intervening commands



Klensin Standards Track [Page 15]

RFC 2821 Simple Mail Transfer Protocol April 2001


"503 bad sequence of commands". Since an attempt to make an
connection to such a system is probably in error, a server
a 554 response on connection opening SHOULD provide
information in the reply text to facilitate debugging of the
system

3.2 Client

Once the server has sent the welcoming message and the client
received it, the client normally sends the EHLO command to
server, indicating the client's identity. In addition to opening
session, use of EHLO indicates that the client is able to
service extensions and requests that the server provide a list of
extensions it supports. Older SMTP systems which are unable
support service extensions and contemporary clients which do
require service extensions in the mail session being initiated,
use HELO instead of EHLO. Servers MUST NOT return the
EHLO-style response to a HELO command. For a particular
attempt, if the server returns a "command not recognized" response
EHLO, the client SHOULD be able to fall back and send HELO

In the EHLO command the host sending the command identifies itself
the command may be interpreted as saying "Hello, I am " (and
in the case of EHLO, "and I support service extension requests").

3.3 Mail

There are three steps to SMTP mail transactions. The
starts with a MAIL command which gives the sender identification
(In general, the MAIL command may be sent only when no
transaction is in progress; see section 4.1.4.) A series of one
more RCPT commands follows giving the receiver information. Then
DATA command initiates transfer of the mail data and is terminated
the "end of mail" data indicator, which also confirms
transaction

The first step in the procedure is the MAIL command

MAIL FROM: [SP parameters> ]
This command tells the SMTP-receiver that a new mail transaction
starting and to reset all its state tables and buffers, including
recipients or mail data. The portion of the first
only argument contains the source mailbox (between "<" and ">"
brackets), which can be used to report errors (see section 4.2 for
discussion of error reporting). If accepted, the SMTP server
a 250 OK reply. If the mailbox specification is not acceptable
some reason, the server MUST return a reply indicating whether



Klensin Standards Track [Page 16]

RFC 2821 Simple Mail Transfer Protocol April 2001


failure is permanent (i.e., will occur again if the client tries
send the same address again) or temporary (i.e., the address might
accepted if the client tries again later). Despite the
scope of this requirement, there are circumstances in which
acceptability of the reverse-path may not be determined until one
more forward-paths (in RCPT commands) can be examined. In
cases, the server MAY reasonably accept the reverse-path (with a 250
reply) and then report problems after the forward-paths are
and examined. Normally, failures produce 550 or 553 replies

Historically, the can contain more than just
mailbox, however, contemporary systems SHOULD NOT use source
(see appendix C).

The optional parameters> are associated with negotiated
service extensions (see section 2.2).

The second step in the procedure is the RCPT command

RCPT TO: [ SP parameters> ]
The first or only argument to this command includes a forward-
(normally a mailbox and domain, always surrounded by "<" and ">"
brackets) identifying one recipient. If accepted, the SMTP
returns a 250 OK reply and stores the forward-path. If the
is known not to be a deliverable address, the SMTP server returns
550 reply, typically with a string such as "no such user - " and
mailbox name (other circumstances and reply codes are possible).
This step of the procedure can be repeated any number of times

The can contain more than just a mailbox
Historically, the can be a source routing list
hosts and the destination mailbox, however, contemporary SMTP
SHOULD NOT utilize source routes (see appendix C). Servers MUST
prepared to encounter a list of source routes in the forward path
but SHOULD ignore the routes or MAY decline to support the
they imply. Similarly, servers MAY decline to accept mail that
destined for other hosts or systems. These restrictions make
server useless as a relay for clients that do not support full
functionality. Consequently, restricted-capability clients MUST
assume that any SMTP server on the Internet can be used as their
processing (relaying) site. If a RCPT command appears without
previous MAIL command, the server MUST return a 503 "Bad sequence
commands" response. The optional parameters> are
with negotiated SMTP service extensions (see section 2.2).

The third step in the procedure is the DATA command (or
alternative specified in a service extension).



Klensin Standards Track [Page 17]

RFC 2821 Simple Mail Transfer Protocol April 2001


DATA
If accepted, the SMTP server returns a 354 Intermediate reply
considers all succeeding lines up to but not including the end
mail data indicator to be the message text. When the end of text
successfully received and stored the SMTP-receiver sends a 250
reply

Since the mail data is sent on the transmission channel, the end
mail data must be indicated so that the command and reply dialog
be resumed. SMTP indicates the end of the mail data by sending
line containing only a "." (period or full stop). A
procedure is used to prevent this from interfering with the user'
text (see section 4.5.2).

The end of mail data indicator also confirms the mail transaction
tells the SMTP server to now process the stored recipients and
data. If accepted, the SMTP server returns a 250 OK reply. The
command can fail at only two points in the protocol exchange

- If there was no MAIL, or no RCPT, command, or all such
were rejected, the server MAY return a "command out of sequence
(503) or "no valid recipients" (554) reply in response to the
command. If one of those replies (or any other 5yz reply)
received, the client MUST NOT send the message data;
generally, message data MUST NOT be sent unless a 354 reply
received

- If the verb is initially accepted and the 354 reply issued,
DATA command should fail only if the mail transaction
incomplete (for example, no recipients), or if resources
unavailable (including, of course, the server
becoming unavailable), or if the server determines that
message should be rejected for policy or other reasons

However, in practice, some servers do not perform
verification until after the message text is received. These
SHOULD treat a failure for one or more recipients as a "
failure" and return a mail message as discussed in section 6.
a "550 mailbox not found" (or equivalent) reply code after the
are accepted makes it difficult or impossible for the client
determine which recipients failed

When RFC 822 format [7, 32] is being used, the mail data include
memo header items such as Date, Subject, To, Cc, From. Server
systems SHOULD NOT reject messages based on perceived defects in
RFC 822 or MIME [12] message header or message body. In particular




Klensin Standards Track [Page 18]

RFC 2821 Simple Mail Transfer Protocol April 2001


they MUST NOT reject messages in which the numbers of Resent-
do not match or Resent-to appears without Resent-from and/or Resent
date

Mail transaction commands MUST be used in the order discussed above

3.4 Forwarding for Address Correction or

Forwarding support is most often required to consolidate and
addresses within, or relative to, some enterprise and less
to establish addresses to link a person's prior address with
one. Silent forwarding of messages (without server notification
the sender), for security or non-disclosure purposes, is common
the contemporary Internet

In both the enterprise and the "new address" cases,
hiding (and sometimes security) considerations argue against
of the "final" address through the SMTP protocol as a side-effect
the forwarding activity. This may be especially important when
final address may not even be reachable by the sender. Consequently
the "forwarding" mechanisms described in section 3.2 of RFC 821,
especially the 251 (corrected destination) and 551 reply codes
RCPT must be evaluated carefully by implementers and, when they
available, by those configuring systems

In particular

* Servers MAY forward messages when they are aware of an
change. When they do so, they MAY either provide address-
information with a 251 code, or may forward "silently" and
a 250 code. But, if a 251 code is used, they MUST NOT assume
the client will actually update address information or even
that information to the user

Alternately

* Servers MAY reject or bounce messages when they are
deliverable when addressed. When they do so, they MAY
provide address-updating information with a 551 code, or
reject the message as undeliverable with a 550 code and
address-specific information. But, if a 551 code is used,
MUST NOT assume that the client will actually update
information or even return that information to the user

SMTP server implementations that support the 251 and/or 551
codes are strongly encouraged to provide configuration mechanisms
that sites which conclude that they would undesirably
information can disable or restrict their use



Klensin Standards Track [Page 19]

RFC 2821 Simple Mail Transfer Protocol April 2001


3.5 Commands for Debugging

3.5.1

SMTP provides commands to verify a user name or obtain the content
a mailing list. This is done with the VRFY and EXPN commands,
have character string arguments. Implementations SHOULD support
and EXPN (however, see section 3.5.2 and 7.3).

For the VRFY command, the string is a user name or a user name
domain (see below). If a normal (i.e., 250) response is returned
the response MAY include the full name of the user and MUST
the mailbox of the user. It MUST be in either of the
forms

User Name local-part@

When a name that is the argument to VRFY could identify more than
mailbox, the server MAY either note the ambiguity or identify
alternatives. In other words, any of the following are
response to VRFY

553 User



553- Ambiguous; Possibilities
553-Joe Smith 553-Harry Smith 553 Melvin Smith


553-Ambiguous;
553- 553- 553
Under normal circumstances, a client receiving a 553 reply would
expected to expose the result to the user. Use of exactly the
given, and the "user ambiguous" or "ambiguous" keywords,
supplemented by extended reply codes such as those described in [34],
will facilitate automated translation into other languages as needed
Of course, a client that was highly automated or that was
in another language than English, might choose to try to
the response, to return some other indication to the user than




Klensin Standards Track [Page 20]

RFC 2821 Simple Mail Transfer Protocol April 2001


literal text of the reply, or to take some automated action such
consulting a directory service for additional information
reporting to the user

For the EXPN command, the string identifies a mailing list, and
successful (i.e., 250) multiline response MAY include the full
of the users and MUST give the mailboxes on the mailing list

In some hosts the distinction between a mailing list and an alias
a single mailbox is a bit fuzzy, since a common data structure
hold both types of entries, and it is possible to have mailing
containing only one mailbox. If a request is made to apply VRFY to
mailing list, a positive response MAY be given if a message
addressed would be delivered to everyone on the list, otherwise
error SHOULD be reported (e.g., "550 That is a mailing list, not
user" or "252 Unable to verify members of mailing list"). If
request is made to expand a user name, the server MAY return
positive response consisting of a list containing one name, or
error MAY be reported (e.g., "550 That is a user name, not a
list").

In the case of a successful multiline reply (normal for EXPN)
one mailbox is to be specified on each line of the reply. The
of an ambiguous request is discussed above

"User name" is a fuzzy term and has been used deliberately.
implementation of the VRFY or EXPN commands MUST include at
recognition of local mailboxes as "user names". However,
current Internet practice often results in a single host
mail for multiple domains, hosts, especially hosts that provide
functionality, SHOULD accept the "local-part@domain" form as a "
name"; hosts MAY also choose to recognize other strings as "
names".

The case of expanding a mailbox list requires a multiline reply,
as

C: EXPN Example-
S: 250-Jon Postel S: 250-Fred Fonebone S: 250 Sam Q. Smith specific.generic.com



C: EXPN Executive-Washroom-
S: 550 Access Denied to You





Klensin Standards Track [Page 21]

RFC 2821 Simple Mail Transfer Protocol April 2001


The character string arguments of the VRFY and EXPN commands
be further restricted due to the variety of implementations of
user name and mailbox list concepts. On some systems it may
appropriate for the argument of the EXPN command to be a file
for a file containing a mailing list, but again there are a
of file naming conventions in the Internet. Similarly,
variations in what is returned by these commands are such that
response SHOULD be interpreted very carefully, if at all, and
generally only be used for diagnostic purposes

3.5.2 VRFY Normal

When normal (2yz or 551) responses are returned from a VRFY or
request, the reply normally includes the mailbox name, i.e.,
"", where "domain" is a fully qualified
name, MUST appear in the syntax. In circumstances exceptional
to justify violating the intent of this specification, free-form
MAY be returned. In order to facilitate parsing by both
and people, addresses SHOULD appear in pointed brackets.
addresses, rather than free-form debugging information, are returned
EXPN and VRFY MUST return only valid domain addresses that are
in SMTP RCPT commands. Consequently, if an address implies
to a program or other system, the mailbox name used to reach
target MUST be given. Paths (explicit source routes) MUST NOT
returned by VRFY or EXPN

Server implementations SHOULD support both VRFY and EXPN.
security reasons, implementations MAY provide local installations
way to disable either or both of these commands through
options or the equivalent. When these commands are supported,
are not required to work across relays when relaying is supported
Since they were both optional in RFC 821, they MUST be listed
service extensions in an EHLO response, if they are supported

3.5.3 Meaning of VRFY or EXPN Success

A server MUST NOT return a 250 code in response to a VRFY or
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
syntax given is valid. In that case, 502 (Command not implemented
or 500 (Syntax error, command unrecognized) SHOULD be returned.
stated elsewhere, implementation (in the sense of actually
addresses and returning information) of VRFY and EXPN are
recommended. Hence, implementations that return 500 or 502 for
are not in full compliance with this specification






Klensin Standards Track [Page 22]

RFC 2821 Simple Mail Transfer Protocol April 2001


There may be circumstances where an address appears to be valid
cannot reasonably be verified in real time, particularly when
server is acting as a mail exchanger for another server or domain
"Apparent validity" in this case would normally involve at
syntax checking and might involve verification that any
specified were ones to which the host expected to be able to
mail. In these situations, reply code 252 SHOULD be returned.
cases parallel the discussion of RCPT verification discussed
section 2.1. Similarly, the discussion in section 3.4 applies to
use of reply codes 251 and 551 with VRFY (and EXPN) to
addresses that are recognized but that would be forwarded or
were mail received for them. Implementations generally SHOULD
more aggressive about address verification in the case of VRFY
in the case of RCPT, even if it takes a little longer to do so

3.5.4 Semantics and Applications of

EXPN is often very useful in debugging and understanding
with mailing lists and multiple-target-address aliases. Some
have attempted to use source expansion of mailing lists as a means
eliminating duplicates. The propagation of aliasing systems
mail on the Internet, for hosts (typically with MX and CNAME
records), for mailboxes (various types of local host aliases), and
various proxying arrangements, has made it nearly impossible
these strategies to work consistently, and mail systems SHOULD
attempt them

3.6

Only resolvable, fully-qualified, domain names (FQDNs) are
when domain names are used in SMTP. In other words, names that
be resolved to MX RRs or A RRs (as discussed in section 5)
permitted, as are CNAME RRs whose targets can be resolved, in turn
to MX or A RRs. Local nicknames or unqualified names MUST NOT
used. There are two exceptions to the rule requiring FQDNs

- The domain name given in the EHLO command MUST BE either a
host name (a domain name that resolves to an A RR) or, if the
has no name, an address literal as described in section 4.1.1.1.

- The reserved mailbox name "postmaster" may be used in a
command without domain qualification (see section 4.1.1.3)
MUST be accepted if so used








Klensin Standards Track [Page 23]

RFC 2821 Simple Mail Transfer Protocol April 2001


3.7

In general, the availability of Mail eXchanger records in the
name system [22, 27] makes the use of explicit source routes in
Internet mail system unnecessary. Many historical problems
their interpretation have made their use undesirable. SMTP
SHOULD NOT generate explicit source routes except under
circumstances. SMTP servers MAY decline to act as mail relays or
accept addresses that specify source routes. When route
is encountered, SMTP servers are also permitted to ignore the
information and simply send to the final destination specified as
last element in the route and SHOULD do so. There has been
invalid practice of using names that do not appear in the DNS
destination names, with the senders counting on the
hosts specified in source routing to resolve any problems. If
routes are stripped, this practice will cause failures. This is
of several reasons why SMTP clients MUST NOT generate invalid
routes or depend on serial resolution of names

When source routes are not used, the process described in RFC 821
constructing a reverse-path from the forward-path is not
and the reverse-path at the time of delivery will simply be
address that appeared in the MAIL command

A relay SMTP server is usually the target of a DNS MX record
designates it, rather than the final delivery system. The
server may accept or reject the task of relaying the mail in the
way it accepts or rejects mail for a local user. If it accepts
task, it then becomes an SMTP client, establishes a
channel to the next SMTP server specified in the DNS (according
the rules in section 5), and sends it the mail. If it declines
relay mail to a particular address for policy reasons, a 550
SHOULD be returned

Many mail-sending clients exist, especially in conjunction
facilities that receive mail via POP3 or IMAP, that have
capability to support some of the requirements of this specification
such as the ability to queue messages for subsequent
attempts. For these clients, it is common practice to make
arrangements to send all messages to a single server for
and subsequent distribution. SMTP, as specified here, is not
suited for this role, and work is underway on standardized
submission protocols that might eventually supercede the
practices. In any event, because these arrangements are private
fall outside the scope of this specification, they are not
here





Klensin Standards Track [Page 24]

RFC 2821 Simple Mail Transfer Protocol April 2001


It is important to note that MX records can point to SMTP
which act as gateways into other environments, not just SMTP
and final delivery systems; see sections 3.8 and 5.

If an SMTP server has accepted the task of relaying the mail
later finds that the destination is incorrect or that the mail
be delivered for some other reason, then it MUST construct
"undeliverable mail" notification message and send it to
originator of the undeliverable mail (as indicated by the reverse
path). Formats specified for non-delivery reports by other
(see, for example, [24, 25]) SHOULD be used if possible

This notification message must be from the SMTP server at the
host or the host that first determines that