2 INTERNET-DRAFT John Klensin, Editor
3 Expires in six months MCI
6 Simple Mail Transfer Protocol
8 draft-ietf-drums-smtpupd-02.txt
12 This document is an Internet-Draft. Internet-Drafts are working
13 documents of the Internet Engineering Task Force (IETF), its areas, and
14 its working groups. Note that other groups may also distribute working
15 documents as Internet-Drafts.
17 Internet-Drafts are draft documents valid for a maximum of six months.
18 Internet-Drafts may be updated, replaced, or obsoleted by other
19 documents at any time. It is not appropriate to use Internet-Drafts as
20 reference material or to cite them other than as a "working draft" or
23 To learn the current status of any Internet-Draft, please check the
24 1id-abstracts.txt listing contained in the Internet-Drafts Shadow
25 Directories on ds.internic.net (US East Coast), nic.nordu.net (Europe),
26 ftp.isi.edu (US West Coast), or munnari.oz.au (Pacific Rim).
28 If consensus is reached on this document, it will be forwarded to the
29 IESG with the recommendation that it be processed as a Proposed
30 Standard for mail transport.
32 [[Sections marked with doubled brackets (e.g., "<<") are explicit
33 placeholders or known major loose ends. The marking ## is a note in
34 the draft to recheck a section number and should be ignored.]]
46 2.2 The extension model
51 3. THE SMTP PROCEDURES: AN OVERVIEW
53 3.1 Session initiation
56 3.4 Forwarding for Address Correction or Updating
57 3.5 Verifying and Expanding
60 3.8 Terminating sessions and connections
62 4. THE SMTP SPECIFICATIONS
65 4.1.1. Command Semantics and Syntax
66 4.1.2. Lower-level Syntax
67 4.1.3 Order of commands
68 4.1.4 Private-use commands
70 4.2.1. Reply Codes by Function Group
71 4.2.2. Reply Codes in Numeric Order
73 4.2.4 Reply codes after DATA and the subsequent CRLF.CRLF.
74 4.3. Sequencing of Commands and Replies
78 4.6.1. Minimum Implementation
80 4.6.3. Sizes and Timeouts
81 4.6.4 Queuing Strategies
83 5. Address resolution and mail handling
85 6. Problem detection and handling
89 7. Security Considerations
98 APPENDIX B: Generating SMTP commands from RFC 822 headers
99 APPENDIX E: Theory of Reply Codes
100 APPENDIX F: Scenarios
101 APPENDIX G: Other gateway issues.
103 APPENDIX I: Deprecated features of RFC 821
104 APPENDIX X: Change summary and Loose ends (temporary)
111 This document is a self-contained specification of the basic protocol
112 for the Internet electronic mail transport, consolodating and
115 * the original SMTP specification of RFC 821 [RFC-821],
116 * Domain name system requirements and implications for mail
117 transport from RFC 1035 [RFC-DNS] and RFC 974 [RFC974],
118 * the clarifications and applicability statements in
119 RFC 1123 [RFC-1123], and
120 * material drawn from the SMTP Extension mechanisms [SMTPEXT].
122 It is intended to replace RFC 821, RFC 974, and the mail transport
123 materials of RFC 1123. However, RFC 821 specifies some features that
124 are not in significant use in the Internet of the mid-1990s and, in
125 appendices, some additional transport models. Those sections are
126 omitted in this document in the interest of clarity and brevity;
127 readers needing them should refer to RFC 821.
129 It also includes some additional material from RFC 1123 that appeared
130 to need amplification. These have been identified in multiple ways,
131 mostly by tracking flaming on the header-people list [HEADER-PEOPLE]
132 and problems of unusual readings or interpretations that have turned
133 up as the SMTP extensions have been deployed. It is important to
134 note that everything here is in response to some identified confusion
135 or bad behavior, not just paranoia.
137 Where this specification moves beyond consolodation and actually
138 differs from earlier documents, it supersedes them technically as
141 Although SMTP was designed as a mail transport and delivery protocol,
142 this specification also contains information that is important to its
143 use as a "mail posting" protocol, as recommended for POP [RFC-POP2,
144 RFC-POP3] and IMAP [RFC-IMAP4].
146 Except when the historical terminology is necessary for clarity, this
147 document uses the current "client" and "server" terminology to
148 identify the sending and receiving SMTP processes, respectively.
150 A companion document discusses mail bodies and formats: RFC 822,
151 MIME, and their relationship.
155 The objective of the Simple Mail Transfer Protocol (SMTP) is to
156 transfer mail reliably and efficiently.
158 SMTP is independent of the particular transmission subsystem and
159 requires only a reliable ordered data stream channel. While this
160 document specifically discusses transport over TCP, other
161 transports are possible. Appendices to RFC 821 describe some of
162 them. A Glossary provides the definitions of terms as used in this
165 An important feature of SMTP is its capability to transport mail
166 across transport service environments, usually referred to as "mail
167 gatewaying". A transport service environment might consist of the
168 mutually-TCP-accessible hosts on the public internet, a
169 firewall-isolated private TCP/IP LAN, or a LAN or WAN environment
170 utilizing an entirely different transport-level protocol. It is
171 important to realize that transport systems are not one-to-one with
172 usual definitions of "networks". A process can communicate directly
173 with another process, and mail communicated, through any mutually
174 known transport layer. Conversely, mail can be relayed (actually
175 gatewayed) between hosts on different transport systems by a host on
176 both transport systems. The Mail eXchanger mechanisms of the domain
177 name system [RFC-DNS, RFC974] usually permit relaying and gatewaying
178 to occur invisibly to the user.
185 The SMTP design is based on the following model of communication: as
186 the result of a user mail request (or transfer from a mail user agent
187 (see section ##2.3)), the SMTP client establishes a two-way
188 transmission channel to an SMTP server. Fully-capable client SMTPs
189 determine the host address supporting the server SMTP function by
190 resolving the domain name in the user request to it into either an
191 intermediate mail exchanger host or a final target host. In other
192 cases, common with clients associated with implementations of the POP
193 [RFC-POP2, RFC-POP3] or IMAP [RFC-IMAP4] protocols, or when the
194 client is inside an isolated transport service enviroment, the SMTP
195 client may send all of its traffic to a single SMTP server which, in
196 turn, relays the mail to final (or other intermediate) destinations.
197 Those destinations in turn support all of the queuing, retrying, and
198 alternate address functions discussed in this specification. The SMTP
199 server may be either the ultimate destination or an intermediate
200 (i.e., may assume the role of an SMTP client after receiving the
201 message). SMTP commands are generated by the SMTP client and sent to
202 the SMTP server. SMTP replies are sent from the SMTP server to the
203 SMTP client in response to the commands.
205 Once the transmission channel is established and initial handshaking
206 completed, the SMTP-client normally initiates a mail transaction.
207 Such a transaction consists of a series of commands to specify the
208 originator and destination of the mail and transmission of the
209 message body (including any headers or other structure) itself. When
210 the same message is sent to multiple recipients the SMTP encourages
211 the transmission of only one copy of the data for all the recipients
212 at the same destination (or intermediate relay) host.
214 The server responds to each command with a reply; replies may
215 indicate that the command was accepted, that additional commands are
216 expected, or that a temporary or permanent error condition exists.
217 Commands that specify the sender or recipients may include
218 server-permitted SMTP service extension requests as discussed in
219 section ##2.2. The dialog is purposely lock-step, one-at-a-time
220 although this can be modified by mutually-agreed extension requests.
222 Once a given mail message has been transmitted, the client may either
223 request that the connection be shut down or may initiate other mail
226 -------------------------------------------------------------
229 +----------+ +----------+
231 | User |<-->| | SMTP | |
232 +------+ | Sender- |Commands/Replies| Receiver-|
233 +------+ | SMTP |<-------------->| SMTP | +------+
234 | File |<-->| | and Mail | |<-->| File |
235 |System| | | | | |System|
236 +------+ +----------+ +----------+ +------+
239 SMTP client SMTP server
245 -------------------------------------------------------------
247 Less commonly, the SMTP protocol and connection may be used by the
248 client to request ancillary services of the server such as
249 verification of addresses or exhibiting the contents of mailing
252 As suggested above, the SMTP provides mechanisms for the transmission
253 of mail. This transmission occurs directly from the sending user's
254 host to the receiving user's host when the two hosts are connected to
255 the same transport service. When they are not connected to the same
256 transport service, transmission occurs via one or more relay
257 SMTP-servers. An intermediate host that will act as either an SMTP
258 relay or as a gateway into some other transmission environment may
259 also be selected through the use of the domain name service (DNS)
260 Mail eXchanger mechanism.
262 To be able to provide the relay capability the server SMTP is
263 supplied with the name of the ultimate destination host as well as
264 the destination mailbox name. Usually, intermediate hosts are
265 determined via the DNS MX record, not by explicit "source" routing
270 2.2 The Extension Model
274 In an effort that started in 1990, approximately a decade after RFC
275 821 was completed, the protocol was modified with a "service
276 extensions" model that permits the client and server to agree to
277 utilize shared functionality that goes beyond the original basic SMTP
278 requirements. Contemporary SMTP implementations MUST support the
279 basic extension mechanisms (see below for details), i.e., servers
280 MUST support the EHLO command even if they do not implement any
281 specific extensions and clients MUST preferentially utilize EHLO
282 rather than HELO. However, for compatibility with older
283 implementations (which are expected to persist for some years), SMTP
284 clients and servers MUST support the original HELO mechanisms as a
287 Although SMTP is widely and robustly deployed, some parts of the
288 Internet community might wish to extend the SMTP service. The SMTP
289 extension mechanism defines a means whereby an extended SMTP client
290 and server may recognize each other as such and the server can inform
291 the client as to the service extensions that it supports.
293 It must be emphasized that any extension to the SMTP service should
294 not be considered lightly. SMTP's strength comes primarily from its
295 simplicity. Experience with many protocols has shown that:
297 protocols with few options tend towards ubiquity, whilst
298 protocols with many options tend towards obscurity.
300 This means that each and every extension, regardless of its benefits,
301 must be carefully scrutinized with respect to its implementation,
302 deployment, and interoperability costs. In many cases, the cost of
303 extending the SMTP service will likely outweigh the benefit.
305 Given this environment, the extension framework consists of:
307 (1) The SMTP command EHLO, superseding the earlier HELO,
309 (2) a registry of SMTP service extensions, and
311 (3) additional parameters to the SMTP MAIL FROM and RCPT TO
315 2.2.2 Definition and Registration of Extensions
317 The IANA maintains a registry of SMTP service extensions.
318 Associated with each such extension is a corresponding EHLO
319 keyword value. Each service extension registered with the IANA
320 must be defined in an RFC. Such RFCs must either be on the
321 standards-track or must define an IESG-approved experimental
322 protocol. The definition must include:
324 (1) the textual name of the SMTP service extension;
326 (2) the EHLO keyword value associated with the extension;
328 (3) the syntax and possible values of parameters associated
329 with the EHLO keyword value;
331 (4) any additional SMTP verbs associated with the extension
332 (additional verbs will usually be, but are not required
333 to be, the same as the EHLO keyword value);
335 (5) any new parameters the extension associates with the
336 MAIL FROM or RCPT TO verbs;
338 (6) how support for the extension affects the behavior of a
339 server and client SMTP; and,
341 (7) the increment by which the extension is increasing the
342 maximum length of the commands MAIL FROM, RCPT TO, or
343 both, over that specified in RFC 821.
345 In addition, any EHLO keyword value that starts with an upper
346 or lower case "X" refers to a local SMTP service extension,
347 which is used through bilateral, rather than standardized,
348 agreement. Keywords beginning with "X" may not be used in a
349 registered service extension.
351 Any keyword values presented in the EHLO response that do not begin
352 with "X" must correspond to a standard, standards-track, or
353 IESG-approved experimental SMTP service extension registered with
354 IANA. A conforming server must not offer non-"X"-prefixed keyword
355 values that are not described in a registered extension.
357 Additional verbs are bound by the same rules as EHLO keywords;
358 specifically, verbs begining with "X" are local extensions
359 that may not be registered or standardized and verbs not
360 beginning with "X" must always be registered.
365 A glossary of terms appears at the end of this document. However,
366 the following terms and concepts are used in special ways here, or
367 represent differences in terminology between RFC 821 and this
368 document, and should be understood before reading further.
372 SMTP relays a mail object containing an envelope and a content.
374 (1) The SMTP envelope is straightforward, and is sent as a
375 series of SMTP protocol units (described in section ##3): it
376 consists of an originator address (to which error reports
377 should be directed); a delivery mode (e.g., deliver to
378 recipient mailboxes); and, one or more recipient addresses.
380 (2) The SMTP content is sent in the SMTP DATA protocol unit
381 and has two parts: the headers and the body. The
382 headers form a collection of field/value pairs
383 structured according to RFC 822 [RFC822], whilst the body,
384 if structured, is defined according to MIME [3]. The
385 content is textual in nature, expressed using the US
386 ASCII repertoire (ANSI X3.4-1986). Although extensions
387 (such as MIME) may relax this restriction for the
388 content body, the content headers are always encoded
389 using the US ASCII repertoire. The algorithm defined in
390 [4] is used to represent header values outside the US
391 ASCII repertoire, whilst still encoding them using the
394 2.3.2. Sender and receivers
396 In RFC 821, the two hosts participating in an SMTP transaction were
397 described as the "SMTP-sender" and "SMTP-receiver". This document
398 has been changed to reflect current industry terminology and hence
399 refers to them as the "SMTP client" (or sometimes just "the client")
400 and "SMTP server" (or just "the server") respectively. Since a given
401 host may act both as server and client in a relay situation,
402 "receiver" and "sender" terminology is still used where needed for
407 Other mail system terminology became common after RFC 821 was
408 published and, where convenient, is used in this specification. In
409 particular, SMTP servers and clients provide a mail transport service
410 and therefore act as Mail Transfer Agents (MTAs). Mail User Agents
411 (MUAs or UAs) are normally thought of as the sources and targets of
412 mail. At the source, an MUA might collect mail to be transmitted
413 from a user and hand it off to an MTA; the final ("delivery") MTA
414 would be thought of as handing the mail off to an MUA (or at least
415 transferring responsibility to it). However, while these terms are
416 used with at least the appearance of great precision in other
417 environments, the implied boundaries between MUAs and MTAs often do
418 not accurately match common, and conforming, practices with Internet
419 mail. Hence, the reader should be cautious about inferring the strong
420 relationships and responsibilities that might be implied if these
421 terms were used elsewhere.
435 <<placeholder -- see "outstanding issues" list>>
438 2.4 Syntax Principles
441 2.4.1 General syntax and transaction model
443 The mail commands and replies have a rigid syntax. Replies also have
444 a numeric code. In the following, examples appear which use actual
445 commands and replies. The complete lists of commands and replies
446 appears in Section ##4 on specifications.
448 Commands and replies are not case sensitive. That is, a command or
449 reply word MAY be upper case, lower case, or any mixture of upper and
450 lower case. Note that this is not true of mailbox user names. For
451 some hosts the user name is case sensitive (this practice impedes
452 interoperability and is discouraged), and SMTP implementations
453 MUST take care to preserve the case of user names as they appear in
454 mailbox arguments. Domain names are not case sensitive.
456 Commands and replies are composed of characters from the ASCII
457 character set [1]. When the transport service provides an 8-bit byte
458 (octet) transmission channel, each 7-bit character is transmitted
459 right justified in an octet with the high order bit cleared to zero.
460 More specifically, the unextended SMTP service provides seven bit
461 transport only. SMTP clients MUST NOT transmit messages with
462 information in the high-order bit of octets. If such messages are
463 transmitted in violation of this rule, receiving SMTP servers MAY
464 clear the high-order bit or reject the message as invalid. Eight-bit
465 transmission MAY be requested of the server by the client using
466 extended SMTP facilities.
468 The metalinguistic notation used in this document corresponds to the
469 "Augmented BNF" used in other Internet mail system documents. The
470 reader who is not familiar with that syntax should consult [ABNF].
473 2.4.2 Command and reply syntax
475 The commands consist of a command code followed by an argument field.
476 Command codes are four alphabetic characters. Upper and lower case
477 alphabetic characters are to be treated identically. Thus, any of
478 the following may represent the mail command:
480 MAIL Mail mail MaIl mAIl
482 This also applies to any symbols representing parameter values, such
483 as "TO" or "to" for the forward-path. Command codes and the argument
484 fields are separated by one or more spaces. However, within the
485 reverse-path and forward-path arguments case is important. In
486 particular, in some hosts the user "smith" is different from the user
489 The argument field consists of a variable length character string
490 ending with the character sequence <CRLF>. The receiver is to take
491 no action until this sequence is received.
493 The syntax for each command is shown with the discussion of that
494 command. Common elements and parameters are shown in section
499 3. THE SMTP PROCEDURES: AN OVERVIEW
501 This section presents the procedures used in SMTP in several parts.
502 After a review of session initiation by the server and client, there
503 is the basic mail procedure defined as a mail transaction. Following
504 this are descriptions of forwarding mail, verifying mailbox names and
505 expanding mailing lists, and the opening and closing exchanges. At
506 the end of this section are comments on relaying, a note on mail
507 domains, and a discussion of changing roles. Throughout this section
508 are examples of partial command and reply sequences, several complete
509 scenarios are presented in Appendix F.
512 3.1 Session initiation
514 An SMTP session is initiated by the client opening a connection to
515 the server and the server responding with an opening message.
517 SMTP server implementations SHOULD include identification of their
518 software and version information in the connection greeting reply
519 after the 220 code. This practice permits much more efficient
520 isolation and repair of any problems. While some systems also
521 identify their contact point for mail problems, this is not a
522 substitute for maintaining the required Postmaster address (see
523 [RFC822]). Implementations MAY make provision for SMTP servers to be
524 configured to disable the software and version announcement where it
525 causes security concerns.
527 3.2 Client initiation: EHLO
529 The client then sends the EHLO command to the server, indicating its
530 identity. In addition to opening the session, use of EHLO indicates
531 that the client is able to process service extensions and requests
532 that the server provide a list of the extensions it supports. Older
533 SMTP systems, unable to support service extensions, MAY use HELO
534 instead of EHLO but EHLO SHOULD be used by all current clients and
535 accepted by all current systems.
537 In the EHLO, or the older HELO, command the host sending the command
538 identifies itself; the command may be interpreted as saying "Hello, I
539 am <domain>" (and, in the case of EHLO, "and I support service
540 extension requests").
542 -------------------------------------------------------------
544 | Example of Connection Opening
546 | R: 220 BBN-UNIX.ARPA Simple Mail Transfer Service Ready
547 | S: HELO USC-ISIF.ARPA
548 | R: 250 BBN-UNIX.ARPA
552 -------------------------------------------------------------
554 -------------------------------------------------------------
556 | Example of Connection Closing
559 | R: 221 BBN-UNIX.ARPA Service closing transmission channel
563 -------------------------------------------------------------
566 3.3. Mail Transactions
568 There are three steps to SMTP mail transactions. The transaction
569 is started with a MAIL command which gives the sender
570 identification. A series of one or more RCPT commands follows
571 giving the receiver information. Then a DATA command gives the
572 mail data. And finally, the end of mail data indicator confirms
575 The first step in the procedure is the MAIL command. The
576 <reverse-path> contains the source mailbox.
578 MAIL <SP> FROM:<reverse-path> [<SP> <mail-parameters>] <CRLF>
580 This command tells the SMTP-receiver that a new mail
581 transaction is starting and to reset all its state tables and
582 buffers, including any recipients or mail data. It gives the
583 reverse-path which can be used to report errors (see section
584 ##4.2 for a discussion of error reporting). If accepted, the
585 SMTP server returns a 250 OK reply.
587 The <reverse-path> can contain more than just a mailbox. The
588 <reverse-path> is a reverse source routing list of hosts and
589 source mailbox. The first host in the <reverse-path> should be
590 the host sending this command.
592 The optional <mail-parameters> are associated with negotiated SMTP
593 service extensions (see section ##2.2).
595 The second step in the procedure is the RCPT command.
597 RCPT <SP> TO:<forward-path> [<SP> <rcpt-parameters>] <CRLF>
599 This command gives a forward-path (normally a mailbox and domain)
600 identifying one recipient. If accepted, the SMTP server returns a
601 250 OK reply, and stores the forward-path. If the recipient is
602 unknown the SMTP server returns a 550 Failure reply (other
603 circumstances and reply codes are possible). This second step of
604 the procedure can be repeated any number of times. The
605 <forward-path> can contain more than just a mailbox. The
606 <forward-path> may be a source routing list of hosts and the
607 destination mailbox. However, in general, the <forward-path>
608 should contain only a mailbox and domain name, relying on the
609 domain name system to supply routing information if required.
610 Servers MUST be prepared to encounter a list of source routes in
611 the forward path, but MAY ignore the routes or decline to support
612 the relaying they imply. Similarly, servers MAY decline to accept
613 mail that is destined for other hosts or systems. Of course, such
614 a restrictions would make a server useless as a relay for clients
615 that do not support full SMTP functionality, but such clients MUST
616 NOT assume that any SMTP server on the Internet can be used as
617 their mail processing site.
619 Clients SHOULD NOT utilize explicit source routing except as
620 discussed in Appendix I.
622 The optional <mail-parameters> are associated with negotiated SMTP
623 service extensions (see section ##2.2).
625 The third step in the procedure is the DATA command.
629 If accepted, the SMTP server returns a 354 Intermediate reply
630 and considers all succeeding lines to be the message text.
631 When the end of text is received and stored the SMTP-receiver
632 sends a 250 OK reply.
634 Since the mail data is sent on the transmission channel, the end
635 of the mail data must be indicated so that the command and
636 reply dialog can be resumed. SMTP indicates the end of the
637 mail data by sending a line containing only "." (period or
638 full stop). A transparency procedure is used to prevent
639 this from interfering with the user's text (see Section ##4.5.2).
641 The end of mail data indicator also confirms the mail transaction
642 and tells the SMTP server to now process the stored recipients and
643 mail data. If accepted, the SMTP server returns a 250 OK reply.
644 The DATA command should fail only if the mail transaction was
645 incomplete (for example, no recipients), or if resources are not
646 available. However, some servers in practice do not perform
647 recipient verification until after the message text is received.
648 These servers SHOULD treat a failure for one or more recipients as
649 a "subsequent failure" and return a mail message as discussed in
650 section ##<<>>. Using a "recipient not found" or equivalent
651 reply code after the data are accepted makes it difficult or
652 impossible for the client to determine which recipients failed.
654 Please note that, when RFC 822 format is being used, the mail data
655 includes the memo header items such as Date, Subject, To, Cc, From
656 [RFC822]. Server SMTP systems SHOULD NOT reject messages based on
657 perceived defects in the RFC 822 or MIME [MIME] message header or
658 message body. In particular, they MUST NOT reject messages on the
659 basis of trying to match numbers of Resent- fields. In
660 particular, messages MUST NOT be rejected because Resent-to
661 appears without Resent-from, Resent-date, or both.
664 The above procedure is an example of a mail transaction. These
665 commands must be used only in the order discussed above.
666 Example 1 (below) illustrates the use of these commands in a mail
670 -------------------------------------------------------------
672 | Example of the SMTP Procedure
674 | This SMTP example shows mail sent by Smith at host Alpha.ARPA,
675 | to Jones, Green, and Brown at host Beta.ARPA. Here we assume
676 | that host Alpha contacts host Beta directly.
678 | S: MAIL FROM:<Smith@Alpha.ARPA>
681 | S: RCPT TO:<Jones@Beta.ARPA>
684 | S: RCPT TO:<Green@Beta.ARPA>
685 | R: 550 No such user here
687 | S: RCPT TO:<Brown@Beta.ARPA>
691 | R: 354 Start mail input; end with <CRLF>.<CRLF>
692 | S: Blah blah blah...
693 | S: ...etc. etc. etc.
697 | The mail has now been accepted for Jones and Brown. Green did
698 | not have a mailbox at domain Beta.ARPA.
702 -------------------------------------------------------------
706 3.4. Forwarding for Address Correction or Updating
708 The "forwarding" mechanisms described in section 3.2 of RFC 821, and
709 especially the 251 reply code from RCPT that indicates a corrected
710 destination, are no longer in active use. Forwarding support is most
711 often required to consolodate and simplify addresses within, or
712 relative to, some enterprise. In most of those cases, information
713 hiding (and sometimes security) considerations argue against exposure
714 of the "final" address through the SMTP protocol as a consequence of
715 the forwarding activity and, in some cases, that final address may
716 not even be reachable by the sender.
718 Silent forwarding of messages (without server notification to the
719 sender) is common in the contemporary Internet.
721 If the forwarding and address correction mechanisms described in
722 RFC 821 are used, the addresses given should be stable enough that
723 it would be reasonable for the client to update local records with
727 3.5. Verifying and Expanding
731 SMTP provides, as additional features, commands to verify a user
732 name or expand a mailing list. This is done with the VRFY and
733 EXPN commands, which have character string arguments. For the
734 VRFY command, the string is a user name (see below) and the
735 response may include the full name of the user and must include
736 the mailbox of the user, e.g., it MUST BE in either
737 User Name <mailbox@domain>
742 Paths (explicit source routes) MUST NOT be returned by VRFY or
745 When a name that is the argument to VRFY could identify more
746 than one mailbox, the server MAY either note the ambiguity or
747 identify the alternatives. In other words, either of the
748 following are legitimate response to VRFY:
752 553- Ambiguous; Possibilities are
753 553-Joe Smith <jsmith@somedomain>
754 553-Harry Smith <hsmith@somedomain>
755 553 Melvin Smith <dweep@somedomain>
757 Under normal circumstances a client receiving a 553 reply
758 would be expected to expose the result to the user. Use
759 of exactly the forms given, and the "user ambiguous" or
760 "ambiguous" keywords, will facilitate automated
761 translation into other languages as needed.
763 For the EXPN command, the string identifies a mailing
764 list, and the multiline response may include the full name of the
765 users and must give the mailboxes on the mailing list.
767 "User name" is a fuzzy term and used purposely. An
768 implementation of the VRFY or EXPN commands MUST include at
769 least recognition of local mailboxes as "user names". If a
770 host chooses to recognize other strings as "user names" that is
773 In some hosts the distinction between a mailing list and an alias
774 for a single mailbox is a bit fuzzy, since a common data structure
775 may hold both types of entries, and it is possible to have mailing
776 lists of one mailbox. If a request is made to verify a mailing
777 list a positive response can be given if on receipt of a message
778 so addressed it will be delivered to everyone on the list,
779 otherwise an error should be reported (e.g., "550 That is a
780 mailing list, not a user"). If a request is made to expand a user
781 name a positive response can be formed by returning a list
782 containing one name, or an error can be reported (e.g., "550 That
783 is a user name, not a mailing list").
785 In the case of a multiline reply (normal for EXPN) exactly one
786 mailbox is to be specified on each line of the reply. The case
787 of an ambiguous request is discussed above.
789 The case of verifying a user name is straightforward as shown in
793 -----------------------------------------------------------------
795 | Example of Verifying a User Name
800 | R: 250 Fred Smith <Smith@USC-ISIF.ARPA>
805 | R: 251 User not local; will forward to <Smith@USC-ISIQ.ARPA>
810 | R: 550 String does not match anything.
815 | R: 551 User not local; please try <Jones@USC-ISIQ.ARPA>
819 | S: VRFY Gourzenkyinplatz
820 | R: 553 User ambiguous.
824 -----------------------------------------------------------------
826 The case of expanding a mailbox list requires a multiline reply as
829 -------------------------------------------------------------
831 | Example of Expanding a Mailing List
835 | S: EXPN Example-People
836 | R: 250-Jon Postel <Postel@USC-ISIF.ARPA>
837 | R: 250-Fred Fonebone <Fonebone@USC-ISIQ.ARPA>
838 | R: 250-Sam Q. Smith <SQSmith@USC-ISIQ.ARPA>
839 | R: 250-Quincy Smith <@USC-ISIF.ARPA:Q-Smith@ISI-VAXA.ARPA>
840 | R: 250-<joe@foo-unix.ARPA>
841 | R: 250 <xyz@bar-unix.ARPA>
845 | S: EXPN Executive-Washroom-List
846 | R: 550 Access Denied to You.
850 -------------------------------------------------------------
852 The character string arguments of the VRFY and EXPN commands
853 cannot be further restricted due to the variety of implementations
854 of the user name and mailbox list concepts. On some systems it
855 may be appropriate for the argument of the EXPN command to be a
856 file name for a file containing a mailing list, but again there is
857 a variety of file naming conventions in the Internet.
860 3.5.2 VRFY normal response.
862 When normal (2yz or 551) responses are returned from a VRFY or EXPN
863 request, the reply MUST include the mailbox name, e.g., "<foo@bar>"
864 (where "bar" is a fully qualified domain name) must appear in the
865 syntax. EXPN and VRFY MUST return only valid domain addresses that
866 are usable in SMTP RCPT commands. Consequently, if an address
867 implies delivery to a program or other system, the mailbox name used
868 to reach that target should be given.
870 Server implementations MUST support VRFY and SHOULD support EXPN. For
871 security reasons, implementations MAY provide local installations a
872 way to disable either or both of these commands through configuration
873 options or the equivalent. When these commands are supported, they
874 are not required to work across relays when relaying is supported.
875 Since they were both optional in RFC 821, they MUST, if supported, be
876 listed in the response to EHLO if service extensions are supported.
879 3.5.3 Meaning of VRFY or EXPN success response.
881 A server MUST NOT return a 220 code in response to a VRFY or EXPN
882 command unless it has actually verified the address. In particular,
883 a server MUST NOT return 220 if all it has done is to verify that the
884 syntax given is valid. In that case 502 (Command not implemented) or
885 500 (Syntax error, command unrecognized) SHOULD be returned (note
886 that implementation of VRFY is required by RFC 1123 and EXPN is
887 strongly recommended; this specification does not change that
888 requirement and, hence, except as provided in section ##3.5.5,
889 implementations that return 500 or 502 for VRFY are not in compliance
890 with the specification).
892 Especially when a server is acting as a mail exchanger for another,
893 there may be circumstances where an address appears to be correct but
894 cannot reasonably be verified in real time. In that situation, reply
895 code 252 SHOULD BE returned. These cases parallel the discussion of
896 RCPT verification discussed in section ##2.1 although implementations
897 generally SHOULD be more aggressive about address verification in the
898 case of VRFY than in the case of RCPT even if a little more time is
902 3.5.4. Semantics and applications of EXPN.
904 While EXPN is often very useful in debugging and understanding
905 problems with mailing lists and multiple-target-address aliases,
906 some systems have attempted to use source expansion of mailing
907 lists as a means of eliminating duplicates. The propagation of
908 aliasing systems with mail on the Internet--both for hosts
909 (typically with MX and CNAME DNS records) and for mailboxes
910 (various types of local host aliases) has made it nearly
911 impossible for these strategies to work, and mail systems SHOULD
915 3.5.5 VRFY, EXPN, and security.
917 As discussed above, individual sites may want to disable one or both
918 of VRFY or EXPN for security reasons. As a corollary to the above,
919 implementations that permit this MUST NOT appear to have verified
920 addresses that are not, in fact, verified. If a site disables these
921 commands for security reasons, the SMTP server SHOULD return a 252
922 response, rather than a code that could be confused with successful
923 or unsuccessful verification.
925 Returning a 250 reply code with the address listed in the VRFY
926 command after having checked it for syntax only violates this
927 rule. Of course, an implementation that "supports" VRFY by
928 always returning 550 whether or not the address is valid is
929 equally not in conformance.
935 Domains have become a key concept in the Internet mail system. The
936 use of domains changes the address space from a flat global space of
937 simple character string host names to a hierarchically structured
938 rooted tree of global addresses. The host name is replaced by a
939 domain and host designator which is a sequence of domain element
940 strings separated by periods with the understanding that the domain
941 elements are ordered from the most specific to the most general.
943 For example, "ISIF.ISI.EDU", "Fred.Cambridge.UK", and
944 "PC7.LCS.MIT.EDU" might be domain identifiers.
946 Whenever domain names are used in SMTP, only resolvable,
947 fully-qualified, domain names (FQDNs) are permitted. In other words,
948 names that can be resolved to MX RRs or A RRs (as discussed in
949 section ##5.??.??) are permitted, as are CNAME RRs whose targets can
950 be resolved, in turn, to MX or A RRs. Local nicknames or unqualified
951 names MUST NOT be used. There is one exception to this rule: the
952 domain name given in the EHLO (or HELO) command MUST BE either a
953 primary host name (a domain name that resolves to an A RR) or, if the
954 host has no name, a domain literal in dotted-decimal notation.
960 The forward-path may be a source route of the form
961 "@ONE,@TWO:JOE@THREE", where ONE, TWO, and THREE MUST BE
962 fully-qualified domain names. This form is used to emphasize the
963 distinction between an address and a route. The mailbox is an
964 absolute address, and the route is information about how to get
965 there. The two concepts should not be confused.
967 In general, the availability of Mail eXchanger records in the
968 domain name system [RFC-DNS] makes the use of explicit source
969 routes in the Internet mail system unnecessary. Many historical
970 problems with their interpretation have made their use
971 undesirable. SMTP clients SHOULD NOT generate explicit source
972 routes except under unusual circumstances. SMTP servers MAY
973 decline to act as mail relays or to accept addresses that
974 specify source routes. They are also permitted to ignore the route
975 information and simply send to the final destination as specified in
976 the route and the DNS. However, there has been a practice, albeit
977 invalid, of using names that do not appear in the DNS as destination
978 names, with the senders counting on the intermediate hosts specified
979 in source routing to resolve any problems. If source routes are
980 stripped, this practice will cause failures -- one of several reasons
981 why SMTP clients MUST NOT generate invalid source routes or depend on
982 serial resolution of names.
984 If source routes are not used, the process described in RFC 821 for
985 constructing a reverse-path from the forward-path is not applicable
986 and the reverse-path at the time of delivery will simply be the
987 address that appeared in the MAIL command. If source routes are
988 used, RFC 821 should be consulted for the mechanisms for constructing
989 and updating the forward- and reverse-paths.
991 Using source routing the SMTP server receives mail to be relayed to
992 another SMTP server. The SMTP server may accept or reject the task
993 of relaying the mail in the same way it accepts or rejects mail for a
994 local user. The SMTP server transforms the command arguments by
995 moving its own identifier (its domain name or that of any domain for
996 which it is acting as a mail exchanger), if it appears, from the
997 forward-path to the beginning of the reverse-path. The SMTP server
998 then becomes an SMTP client, establishes a transmission channel to
999 the next SMTP server in the forward-path, and sends it the mail.
1001 Notice that the forward-path and reverse-path appear in the SMTP
1002 commands and replies, but not necessarily in the message. That is,
1003 there is no need for these paths and especially this syntax to appear
1004 in the "To:" , "From:", "CC:", etc. fields of the message header.
1005 Conversely, SMTP servers MUST NOT derive final message delivery
1006 information from message header fields.
1008 If an SMTP server has accepted the task of relaying the mail and
1009 later finds that the forward-path is incorrect or that the mail
1010 cannot be delivered for some other reason, then it MUST construct an
1011 "undeliverable mail" notification message and send it to the
1012 originator of the undeliverable mail (as indicated by the
1013 reverse-path). Formats specified for non-delivery reports by other
1014 standards SHOULD be used if possible.
1016 This notification message must be from the SMTP server at the relay
1017 host or the host that first determines that delivery cannot be
1018 accomplished. Of course, SMTP servers should not send notification
1019 messages about problems with notification messages. One way to
1020 prevent loops in error reporting is to specify a null reverse-path in
1021 the MAIL command of a notification message. When such a message is
1022 transmitted the reverse-path SHOULD BE set to null. A MAIL command
1023 with a null reverse-path appears as follows:
1027 An undeliverable mail notification message is shown in example 7.
1028 This notification is in response to a message originated by JOE at
1029 HOSTW and sent via HOSTX to HOSTY with instructions to relay it on
1030 to HOSTZ. What we see in the example is the transaction between
1031 HOSTY and HOSTX, which is the first step in the return of the
1032 notification message.
1034 -------------------------------------------------------------
1036 | Example Undeliverable Mail Notification Message
1040 | S: RCPT TO:<@HOSTX.ARPA:JOE@HOSTW.ARPA>
1043 | R: 354 send the mail data, end with .
1044 | S: Date: 23 Oct 81 11:22:33
1045 | S: From: SMTP@HOSTY.ARPA
1046 | S: To: JOE@HOSTW.ARPA
1047 | S: Subject: Mail System Problem
1049 <<>>replace with NOTARY format <<>>
1055 -------------------------------------------------------------
1061 3.8. Terminating Sessions and Connections
1063 An SMTP connection is terminated by the client's sending a QUIT
1064 command. The server then responds with a positive reply code, after
1065 which it closes the connection.
1067 An SMTP server MUST NOT intentionally close the connection
1069 o After receiving a QUIT connand and responding with a 221 reply.
1070 o After detecting the need to shutdown the SMTP service and
1071 returning a 451 reply to any command.
1073 In particular, a server that closes connections in response
1074 to commands that are not understood is in violation of this
1075 specification. Instead, servers are expected to be tolerant of
1076 unknown commands, issuing a 500 reply and awaiting further
1077 instructions from the client.
1079 An SMTP server which is forcibly shut down via external
1080 means SHOULD attempt to send a line containing 451 response
1081 code to the SMTP client before exiting. The SMTP client will
1082 normally read the 451 response code after sending its next
1088 4. THE SMTP SPECIFICATIONS
1092 4.1.1. COMMAND SEMANTICS AND SYNTAX
1094 The SMTP commands define the mail transfer or the mail system
1095 function requested by the user. SMTP commands are character strings
1096 terminated by <CRLF>. The command codes themselves are alphabetic
1097 characters terminated by <SP> if parameters follow and <CRLF>
1098 otherwise. The syntax of mailboxes must conform to receiver site
1099 conventions. The SMTP commands are discussed below. The SMTP
1100 replies are discussed in Section ##4.2.
1102 A mail transaction involves several data objects which are
1103 communicated as arguments to different commands. The reverse-path is
1104 the argument of the MAIL command, the forward-path is the argument of
1105 the RCPT command, and the mail data is the argument of the DATA
1106 command. These arguments or data objects must be transmitted and
1107 held pending the confirmation communicated by the end of mail data
1108 indication which finalizes the transaction. The model for this is
1109 that distinct buffers are provided to hold the types of data objects,
1110 that is, there is a reverse-path buffer, a forward-path buffer, and a
1111 mail data buffer. Specific commands cause information to be appended
1112 to a specific buffer, or cause one or more buffers to be cleared.
1115 4.1.1.1 Extended HELLO (EHLO) or HELLO (HELO)
1117 These commands are used to identify the SMTP client to the SMTP
1118 server. The argument field contains the host name of the SMTP
1121 The SMTP server identifies itself to the SMTP client in the
1122 connection greeting reply, and in the response to this command.
1124 A client SMTP SHOULD start an SMTP session by issuing the EHLO
1125 command. If the SMTP server supports the SMTP service extensions it
1126 will give a successful response, a failure response, or an error
1127 response. If the SMTP server does not support any SMTP service
1128 extensions it will generate an error response. Older client SMTP
1129 systems MAY, as discussed above, use HELO (as specified in RFC 821)
1132 These commands and an OK reply to one of them confirm that both the
1133 SMTP client and the SMTP server are in the initial state, that is,
1134 there is no transaction in progress and all state tables and buffers
1137 If the server SMTP implements and is able to perform the EHLO
1138 command, it will return code 250. This indicates that both the
1139 server and client SMTP are in the initial state, that is, there is no
1140 transaction in progress and all state tables and buffers are cleared.
1142 Normally, this response will be a multiline reply. Each line of the
1143 response contains a keyword and, optionally, one or more parameters.
1144 The syntax for a positive response, using the ABNF notation of
1147 ehlo-ok-rsp ::= "250" domain [ SP greeting ] CR LF
1148 / ( "250-" domain [ SP greeting ] CR LF
1149 *( "250-" ehlo-line CR LF )
1150 "250" SP ehlo-line CR LF )
1152 ; the usual HELO chit-chat
1153 greeting ::= 1*<any character other than CR or LF>
1155 ehlo-line ::= ehlo-keyword *( SP ehlo-param )
1157 ehlo-keyword ::= (ALPHA / DIGIT) *(ALPHA / DIGIT / "-")
1159 ; syntax and values depend on ehlo-keyword
1160 ehlo-param ::= 1*<any CHAR excluding SP and all
1161 control characters (US ASCII 0-31
1164 ALPHA ::= <any one of the 52 alphabetic characters
1165 (A through Z in upper case, and,
1166 a through z in lower case)>
1167 DIGIT ::= <any one of the 10 numeric characters
1170 CR ::= <the carriage-return character
1171 (ASCII decimal code 13)>
1172 LF ::= <the line-feed character
1173 (ASCII decimal code 10)>
1174 SP ::= <the space character
1175 (ASCII decimal code 32)>
1177 Although EHLO keywords may be specified in upper, lower, or mixed
1178 case, they must always be recognized and processed in a
1179 case-insensitive manner. This is simply an extension of practices
1180 specified in RFC 821.
1185 This command is used to initiate a mail transaction in which the mail
1186 data is delivered to one or more mailboxes. The argument field
1187 contains a reverse-path.
1189 The reverse-path consists of an optional list of hosts and the sender
1190 mailbox. When the list of hosts is present, it is a "reverse" source
1191 route and indicates that the mail was relayed through each host on
1192 the list (the first host in the list was the most recent relay).
1193 This list is used as a source route to return non-delivery notices to
1194 the sender. As each relay host adds itself to the beginning of the
1195 list, it must use its name as known in the transport environment to
1196 which it is relaying the mail rather than that of the transport
1197 environment from which the mail came (if they are different). In
1198 some types of error reporting messages (for example, undeliverable
1199 mail notifications) the reverse-path may be null (see Example 7).
1201 This command clears the reverse-path buffer, the forward-path buffer,
1202 and the mail data buffer; and inserts the reverse-path information
1203 from this command into the reverse-path buffer.
1205 If service extensions were negotiated, the MAIL command may also
1206 carry parameters associated with a particular service extension.
1208 Syntax: "MAIL FROM:" Reverse-path [ Mail-parameters ]
1213 4.1.1.3 RECIPIENT (RCPT)
1215 This command is used to identify an individual recipient of
1216 the mail data; multiple recipients are specified by multiple
1217 use of this command.
1219 The forward-path consists of an optional list of hosts and a
1220 required destination mailbox. When the list of hosts is
1221 present, it is a source route and indicates that the mail
1222 must be relayed to the next host on the list. If the
1223 SMTP server does not implement the relay function it may
1224 user the same reply it would for an unknown local user
1227 When mail is relayed, the relay host must remove itself from
1228 the beginning forward-path and put itself at the beginning
1229 of the reverse-path. When mail reaches its ultimate
1230 destination (the forward-path contains only a destination
1231 mailbox), the SMTP server inserts it into the destination
1232 mailbox in accordance with its host mail conventions.
1235 For example, mail received at relay host A with arguments
1237 FROM:<USERX@HOSTY.ARPA>
1238 TO:<@HOSTA.ARPA,@HOSTB.ARPA:USERC@HOSTD.ARPA>
1240 will be relayed on to host B with arguments
1242 FROM:<@HOSTA.ARPA:USERX@HOSTY.ARPA>
1243 TO:<@HOSTB.ARPA:USERC@HOSTD.ARPA>.
1245 This command causes its forward-path argument to be appended
1246 to the forward-path buffer.
1248 If service extensions were negotiated, the MAIL command may also
1249 carry parameters associated with a particular service extension.
1251 Syntax: "RCPT TO:" Forward-path [ Rcpt-parameters ]
1256 The receiver treats the lines (strings ending in CRLF sequences)
1257 following the command as mail data from the sender. This command
1258 causes the mail data from this command to be appended to the mail
1259 data buffer. The mail data may contain any of the 128 ASCII
1262 SMTP is defined in terms of sending messages consisting of lines of
1263 text. Lines are strictly defined as ending in ASCII CR LF sequences.
1264 Systems that use other line delimiting mechanisms internally MUST
1265 convert to CR LF sequences before transmitting mail with unextended
1266 SMTP or with any SMTP service extension on the standards track as of
1267 the time of this writing.
1269 The mail data is terminated by a line containing only a period, that
1270 is the character sequence "<CRLF>.<CRLF>" (see Section ##4.6.2 on
1271 Transparency). This is the end of mail data indication.
1273 The custom of accepting lines ending only in LF, as a concession to
1274 non-conforming behavior on the part of some UNIX systems, has proven
1275 to cause more interoperability problems than it solves and SMTP
1276 server systems MUST NOT do this, even in the name of improved
1277 robustness. In particular, the sequence "LF.LF" (bare line feeds,
1278 without carriage returns) MUST NOT be treated as equivalent to
1279 CRLF.CRLF as the end of mail data indication.
1282 Receipt of the end of mail data indication requires that the server
1283 process the stored mail transaction information. This processing
1284 consumes the information in the reverse-path buffer, the forward-path
1285 buffer, and the mail data buffer, and on the completion of this
1286 command these buffers are cleared. If the processing is successful
1287 the receiver must send an OK reply. If the processing fails
1288 completely the receiver must send a failure reply.
1290 When the SMTP server accepts a message either for relaying or for
1291 final delivery it inserts a trace record (also referred to
1292 interchangabily as a "time stamp line" or "Received" line) at the top
1293 of the mail data. This trace record indicates the identity of the
1294 host that sent the message, and the identity of the host that
1295 received the message (and that is inserting this time stamp), and the
1296 date and time the message was received. Relayed messages will have
1297 multiple time stamp lines. Details for formation of these lines,
1298 including their syntax, is specified in section ##4.4.
1301 4.1.1.5 RESET (RSET)
1303 This command specifies that the current mail transaction is to be
1304 aborted. Any stored sender, recipients, and mail data must be
1305 discarded, and all buffers and state tables cleared. The receiver
1306 must send an OK reply. A reset command may be issued by the client
1307 at any time. It is effectively equivalent to a NOOP if issued
1308 immediately after EHLO or HELO, or before either of those commands
1309 have been issued. In other situations, it restores the state to
1310 that immediately after the most recent EHLO or HELO. An SMTP server
1311 MUST NOT close the connection as the result of receiving a RSET; that
1312 action is reserved for QUIT (see section ##4.1.1.10, below).
1314 4.1.1.6 VERIFY (VRFY)
1316 This command asks the receiver to confirm that the argument
1317 identifies a user. If it is a user name, the full name of
1318 the user (if known) and the fully specified mailbox are
1321 This command has no effect on any of the reverse-path
1322 buffer, the forward-path buffer, or the mail data buffer.
1324 Syntax: "VRFY" SP String
1326 4.1.1.7 EXPAND (EXPN)
1328 This command asks the receiver to confirm that the argument
1329 identifies a mailing list, and if so, to return the
1330 membership of that list. The full name of the users (if
1331 known) and the fully specified mailboxes are returned in a
1334 This command has no effect on any of the reverse-path
1335 buffer, the forward-path buffer, or the mail data buffer.
1337 Syntax: "EXPN" SP String
1341 This command causes the receiver to send helpful information
1342 to the sender of the HELP command. The command MAY take an
1343 argument (e.g., any command name) and return more specific
1344 information as a response.
1346 This command has no effect on any of the reverse-path
1347 buffer, the forward-path buffer, or the mail data buffer.
1349 SMTP servers SHOULD support HELP even if the form with an argument
1352 Syntax: "HELP" [ SP String ]
1357 This command does not affect any parameters or previously
1358 entered commands. It specifies no action other than that
1359 the receiver send an OK reply.
1361 This command has no effect on any of the reverse-path
1362 buffer, the forward-path buffer, or the mail data buffer.
1364 Syntax: "NOOP" [SP String]
1366 4.1.1.10 QUIT (QUIT)
1368 This command specifies that the receiver must send an OK
1369 reply, and then close the transmission channel.
1371 The receiver MUST NOT intentionally close the transmission channel
1372 until it receives and replies to a QUIT command (even if there was
1373 an error). The sender MUST NOT intentionally close the
1374 transmission channel until it send a QUIT command and receives the
1375 reply (even if there was an error response to a previous command).
1376 If the connection is closed prematurely due to violations of the
1377 above or system or network failure the server MUST act as if a
1378 RSET command had been received (cancelling any pending
1379 transaction, but not undoing any previously completed transaction)
1380 and the client MUST act as if the command or transaction in
1381 progress had received a temporary error (4xx).
1386 4.1.2. LOWER-LEVEL SYNTAX
1388 The syntax of the argument fields of the above commands (using the
1389 syntax specified in [ABNF] where applicable) is given below.
1391 Reverse-path ::= Path
1393 Forward-path ::= Path
1395 Path ::= "<" [ A-d-l ":" ] <mailbox> ">"
1397 A-d-l ::= At-domain *( "," A-d-l )
1399 At-domain ::= "@" Domain
1401 Mail-parameters ::= *( SP Keyword "=" Argument )
1403 Rcpt-parameters ::= *( SP Keyword "=" Argument )
1405 Keyword ::= String <<>>???
1406 Argument ::= String <<>>???
1408 Domain ::= sub-domain 1*("." sub-domain) | domain-literal
1410 sub-domain ::= let-dig *(ldh-str)
1411 domain-literal = "[" IP-address-literal "]"
1412 IP-address-literal = snum 3*("." snum)
1413 snum = one, two, or three digits representing a decimal
1414 integer value in the range 0 through 255
1415 let-dig = Alpha / Digit
1416 ldh-str = *( Alpha / Digit / "-" ) 1*(let-dig)
1418 Alpha = ASCII character in the range A-Z or a-z. As specified in
1419 the domain name system definition [RFC-DNS], case is not
1420 significant in domain strings.
1424 Mailbox ::= Local-part "@" Domain
1426 Local-part ::= Dot-string | Quoted-string
1428 While the definition for Local-part above is relatively
1429 permissive, for maximum interoperability, a host that expects to
1430 receive mail SHOULD avoid defining mailboxes where the Local-part
1431 requires (or uses) the Quoted-string form or where the Local-part
1434 Systems MUST NOT define mailboxes in such a way as to require the use
1435 of non-ASCII characters (octets with the high order bit set to one)
1436 or ASCII "control characters" (decimal value 0-31 and 127). These
1437 characters MUST NOT be used in MAIL FROM or RCPT TO commands or other
1438 commands that require mailbox names.
1441 <<?>> <string> ::= <char> | <char> <string>
1443 <<?>> <quoted-string> ::= """ <qtext> """
1445 <<?>> <qtext> ::= "\" <x> | "\" <x> <qtext> | <q> | <q> <qtext>
1447 <char> ::= <c> | "\" <x>
1449 <number> ::= <d> | <d> <number>
1451 <CRLF> ::= <CR> <LF>
1453 <CR> ::= the carriage return character (ASCII code 13)
1455 <LF> ::= the line feed character (ASCII code 10)
1457 <SP> ::= the space character (ASCII code 32)
1459 <snum> ::= one, two, or three digits representing a decimal
1460 integer value in the range 0 through 255
1462 <a> ::= any one of the 52 alphabetic characters A through Z
1463 in upper case and a through z in lower case
1465 <c> ::= any one of the 128 ASCII characters, but not any
1468 <d> ::= any one of the ten digits 0 through 9
1470 <q> ::= any one of the 128 ASCII characters except <CR>,
1471 <LF>, quote ("), or backslash (\)
1473 <x> ::= any one of the 128 ASCII characters (no exceptions)
1475 <special> ::= "<" | ">" | "(" | ")" | "[" | "]" | "\" | "."
1476 | "," | ";" | ":" | "@" """ | the control
1477 characters (ASCII codes 0 through 31 inclusive and
1480 Note that the backslash, "\", is a quote character, which is
1481 used to indicate that the next character is to be used
1482 literally (instead of its normal interpretation). For example,
1483 "Joe\,Smith" could be used to indicate a single nine character
1484 user field with comma being the fourth character of the field.
1486 Characters outside the set of specials, alphas, digits, and hyphen
1487 are prohibited by the domain name system definition and MUST NOT
1488 appear in domain names. In particular, the underscore character is
1491 Sometimes a host is not known to the translation function and
1492 communication is blocked. To bypass this barrier a numeric form is
1493 also allowed for host "names". This form uses four or more small
1494 decimal integers separated by dots and enclosed by brackets, e.g.,
1495 "[123.255.37.2]", which indicates an Internet Address in
1496 sequence-of-octets form.
1498 The time stamp line and the return path line are formally defined as
1501 <return-path-line> ::= "Return-Path:" <SP><reverse-path><CRLF>
1503 <time-stamp-line> ::= "Received:" <SP> <stamp> <CRLF>
1505 <stamp> ::= <from-domain> <by-domain> <opt-info> ";"
1508 <from-domain> ::= "FROM" <SP> <domain> <SP>
1510 <by-domain> ::= "BY" <SP> <domain> <SP>
1512 <opt-info> ::= [<via>] [<with>] [<id>] [<for>]
1514 <via> ::= "VIA" <SP> <link> <SP>
1516 <with> ::= "WITH" <SP> <protocol> <SP>
1518 <id> ::= "ID" <SP> <string> <SP>
1520 <for> ::= "FOR" <SP> <path> <SP>
1522 <<>>FOR and <link> need to be nailed down.
1524 <link> ::= The standard names for links are registered with
1525 the Internet Assigned Numbers Authority (IANA).
1527 <protocol> ::= The standard names for protocols are
1528 registered with the Internet Assigned Numbers Authority
1531 <daytime> ::= <SP> <date> <SP> <time>
1533 <date> ::= <dd> <SP> <mon> <SP> <yyyy>
1535 Note that the earlier form, which permits
1536 two-digit years, is deprecated. SMTP systems
1537 SHOULD use four-digit years.
1539 <time> ::= <hh> ":" <mm> ":" <ss> <SP> <zone>
1541 <dd> ::= the one or two decimal integer day of the month in
1544 <mon> ::= "JAN" | "FEB" | "MAR" | "APR" | "MAY" | "JUN" |
1545 "JUL" | "AUG" | "SEP" | "OCT" | "NOV" | "DEC"
1547 <yyyy> ::= the four decimal integer year in the range 0000 to
1550 <hh> ::= the two decimal integer hour of the day in the
1553 <mm> ::= the two decimal integer minute of the hour in the
1556 <ss> ::= the two decimal integer second of the minute in the
1559 <zone> ::= A four-digit time zone offset, such as -0600 for US
1560 Eastern Standard Time. This may be supplemented by a
1561 time zone name in parentheses, e.g., "-0800 (PDT)". See
1562 ??? for additional discussion.
1564 Note that there is no default; time zone information
1565 is required and MUST be supplied.
1569 -------------------------------------------------------------
1571 | Return Path Example
1573 | Return-Path: <@CHARLIE.ARPA,@BAKER.ARPA:JOE@ABLE.ARPA>
1577 -------------------------------------------------------------
1579 -------------------------------------------------------------
1581 | Time Stamp Line Example
1583 | Received: FROM ABC.ARPA BY XYZ.ARPA ; 22 OCT 81
1586 | Received: from ABC.ARPA by XYZ.ARPA via TELENET with X25
1587 | id M12345 for Smith@PDQ.ARPA ; 22 OCT 81 09:23:59 PDT
1591 --------------------------------------------------------------
1594 4.1.3. Order of commands
1596 There are restrictions on the order in which these commands may
1599 A session that is to contain mail transactions MUST first be
1600 initialized by the use of the HELO or EHLO command. An SMTP server
1601 SHOULD accept commands for non-mail transactions (e.g., VRFY or EXPN)
1602 without this initialization.
1604 HELO or EHLO commands MAY be issued by a client later in the session.
1605 If either is issued after the session begins, the SMTP server MUST
1606 clear all buffers and state as if an RSET command had been issued.
1607 In other words, the sequence of RSET followed immediately by HELO is
1608 redundant, but not harmful other than in the performance cost of
1609 executing unnecessary commands.
1611 If the HELO or EHLO commands are not acceptable to the SMTP server,
1612 501, 500, or 502 failure replies MUST be returned as appropriate.
1613 The SMTP server must stay in the same state after transmitting these
1614 replies as it was in before the HELO or EHLO were received.
1616 RFC 1123 contains a discussion of arguments to HELO and conditions
1617 under which the HELO command can be rejected. In particular, HELO
1618 (or EHLO) MUST NOT be rejected because the client's putative name
1619 does not match some criteria established by the server (e.g.,
1620 verification of reverse DNS mapping).
1622 The NOOP, HELP, EXPN, VRFY, and RSET commands can be used at any time
1623 during a session, or without previously initializing a session. SMTP
1624 servers SHOULD process these normally (i.e., not return a 503 code)
1625 even if no HELO or EHLO command has yet been received; clients SHOULD
1626 open a session with HELO or EHLO before sending these commands.
1628 If the above rules are followed, the example in RFC 821 that shows
1629 "550 access denied to you" in response to an EXPN command is
1630 essentially meaningless unless a HELO or EHLO command preceeds the
1631 EXPN or the denial of access is based on the client's IP address.
1633 The MAIL, SEND, SOML, or SAML commands begin a mail transaction.
1634 Once started a mail transaction consists of one of the transaction
1635 beginning commands, one or more RCPT commands, and a DATA command, in
1636 that order. A mail transaction may be aborted by the RSET command.
1637 There may be zero or more transactions in a session.
1639 If the transaction beginning command argument is not acceptable a 501
1640 failure reply MUST be returned and the SMTP server must stay in the
1641 same state. If the commands in a transaction are out of order to the
1642 degree that they cannot be processed by the server a 503 failure
1643 reply MUST be returned and the SMTP server must stay in the same
1646 The last command in a session must be the QUIT command. The QUIT
1647 command can not be used at any other time in a session, but may be
1648 used by the client SMTP to request connection-closing even if no
1649 session-opening command has been sent and accepted.
1653 4.1.4 Private-use commands
1655 Commands starting in "X" may be used by bilateral agreement
1656 between the client (sending) and server (receiving) SMTPs.
1657 An SMTP server that does not recognize such a command is
1658 expected to reply with "500 Command not recognized". An
1659 extended SMTP server MAY list the feature names associated
1660 with these private commands in the response to the EHLO
1663 Commands sent or accepted by SMTP systems that do not start
1664 with "X" MUST be documented in published RFCs and be at
1665 least candidates for standardization.
1671 Replies to SMTP commands are devised to ensure the synchronization of
1672 requests and actions in the process of mail transfer, and to
1673 guarantee that the SMTP client always knows the state of the SMTP
1674 server. Every command must generate exactly one reply.
1676 The details of the command-reply sequence are made explicit in
1677 Section ##4.3 on Sequencing and Section ##4.5 containing State
1680 An SMTP reply consists of a three digit number (transmitted as three
1681 alphanumeric characters) followed by some text. The number is
1682 intended for use by automata to determine what state to enter next;
1683 the text is meant for the human user. It is intended that the three
1684 digits contain enough encoded information that the SMTP client need
1685 not examine the text and may either discard it or pass it on to the
1686 user, as appropriate. In particular, the text may be
1687 receiver-dependent and context dependent, so there are likely to be
1688 varying texts for each reply code. A discussion of the theory of
1689 reply codes is given in Appendix E. Formally, a reply is defined to
1690 be the sequence: a three-digit code, SP, one line of text, and
1691 CRLF, or a multiline reply (as defined in Appendix E). Only the
1692 EXPN and HELP commands are expected to result in multiline replies in
1693 normal circumstances, however multiline replies are allowed for any
1696 An SMTP server SHOULD send only the reply codes listed in this
1697 document. An SMTP server SHOULD use the text shown in the examples
1698 whenever appropriate.
1700 A client SMTP MUST determine its actions only by the reply
1701 code, not by the text (except for 251 and 551 replies); any
1702 text, including no text at all, must be acceptable. The space
1703 (blank) following the reply code is considered part of the
1704 text. Whenever possible, a sender-SMTP SHOULD test only the
1705 first digit of the reply code.
1709 4.2.1. REPLY CODES BY FUNCTION GROUPS
1711 500 Syntax error, command unrecognized
1712 [This may include errors such as command line too long]
1713 501 Syntax error in parameters or arguments
1714 502 Command not implemented (see section ##4.2.3)
1715 503 Bad sequence of commands
1716 504 Command parameter not implemented
1718 211 System status, or system help reply
1720 [Information on how to use the receiver or the meaning of a
1721 particular non-standard command; this reply is useful only
1724 220 <domain> Service ready
1725 221 <domain> Service closing transmission channel
1726 421 <domain> Service not available,
1727 closing transmission channel
1728 [This may be a reply to any command if the service knows it
1731 250 Requested mail action okay, completed
1732 251 User not local; will forward to <forward-path>
1733 252 Cannot VRFY user, but will accept message and attempt
1735 450 Requested mail action not taken: mailbox unavailable
1736 [E.g., mailbox busy]
1737 550 Requested action not taken: mailbox unavailable
1738 [E.g., mailbox not found, no access]
1739 451 Requested action aborted: error in processing
1740 551 User not local; please try <forward-path>
1741 452 Requested action not taken: insufficient system storage
1742 552 Requested mail action aborted: exceeded storage allocation
1743 553 Requested action not taken: mailbox name not allowed
1744 [E.g., mailbox syntax incorrect]
1745 354 Start mail input; end with <CRLF>.<CRLF>
1746 554 Transaction failed
1749 4.2.2. NUMERIC ORDER LIST OF REPLY CODES
1751 211 System status, or system help reply
1753 [Information on how to use the receiver or the meaning of a
1754 particular non-standard command; this reply is useful only
1756 220 <domain> Service ready
1757 221 <domain> Service closing transmission channel
1758 250 Requested mail action okay, completed
1759 251 User not local; will forward to <forward-path>
1760 252 Cannot VRFY user, but will accept message and attempt
1763 354 Start mail input; end with <CRLF>.<CRLF>
1765 421 <domain> Service not available,
1766 closing transmission channel
1767 [This may be a reply to any command if the service knows it
1769 450 Requested mail action not taken: mailbox unavailable
1770 [E.g., mailbox busy]
1771 451 Requested action aborted: local error in processing
1772 452 Requested action not taken: insufficient system storage
1774 500 Syntax error, command unrecognized
1775 [This may include errors such as command line too long]
1776 501 Syntax error in parameters or arguments
1777 502 Command not implemented
1778 503 Bad sequence of commands
1779 504 Command parameter not implemented
1780 550 Requested action not taken: mailbox unavailable
1781 [E.g., mailbox not found, no access]
1782 551 User not local; please try <forward-path>
1783 552 Requested mail action aborted: exceeded storage allocation
1784 553 Requested action not taken: mailbox name not allowed
1785 [E.g., mailbox syntax incorrect]
1786 554 Transaction failed
1789 4.2.3. Reply code 502
1791 Questions have been raised as to when reply code 502 (Command
1792 not implemented) should be returned in preference to other
1793 codes. 502 SHOULD be used when the command is actually
1794 recognized by the SMTP server, but not implemented. If the
1795 command is not recognized, code 500 SHOULD be returned.
1796 Extended SMTP systems MUST NOT list capabilities in response to
1797 EHLO for which they will return 502 (or 500) replies.
1800 4.2.4 Reply codes after DATA and the subsequent CRLF.CRLF.
1802 When an SMTP server returns a positive completion status (2yz
1803 code) after the DATA command is completed with CRLF.CRLF, it
1804 accepts responsibity for:
1806 + delivering the message (if the recipient mailbox exists), or
1808 + if attempts to deliver the message fail due to transient
1809 conditions, retrying delivery some reasonable number of times
1810 at intervals as specified in RFC 1123, or
1812 + if attempts to deliver the message fail due to permanent
1813 conditions, or if repeated attempts to deliver the message
1814 fail due to transient conditions, returning appropriate
1815 notification to the sender of the original message (using the
1816 address in the SMTP MAIL FROM command).
1819 When an SMTP server returns a transient error completion status
1820 (4yz) code after the DATA command is completed with CRLF.CRLF,
1821 it MUST NOT make any further attempt to deliver that message.
1822 The SMTP client retains responsibility for delivery of that
1823 message. The sending user should be able to interpret the
1824 return of a transient or permanent failure status as a
1825 non-delivery indication.
1830 4.3. SEQUENCING OF COMMANDS AND REPLIES
1832 4.3.1 Sequencing overview
1834 The communication between the sender and receiver is intended to be
1835 an alternating dialogue, controlled by the sender. As such, the
1836 sender issues a command and the receiver responds with a reply.
1837 Unless other arrangements are negotiated through service extensions,
1838 the sender must wait for this response before sending further
1841 One important reply is the connection greeting. Normally, a receiver
1842 will send a 220 "Service ready" reply when the connection is
1843 completed. The sender should wait for this greeting message before
1844 sending any commands.
1846 Note: all the greeting type replies have the official name (i.e., the
1847 fully-qualified primary domain name) of the server host as the first
1848 word following the reply code. When the host has no name, the IP
1849 address should be used, in bracketed dotted-octet format, e.g.,
1854 220 <SP> USC-ISIF.ARPA <SP> Service ready <CRLF>
1857 The table below lists alternative success and failure replies for
1858 each command. These must be strictly adhered to; a receiver may
1859 substitute text in the replies, but the meaning and action implied
1860 by the code numbers and by the specific command reply sequence
1863 COMMAND-REPLY SEQUENCES
1865 Each command is listed with its usual possible replies. The prefixes
1866 used before the possible replies are "P" for preliminary (not used in
1867 SMTP), "I" for intermediate, "S" for success, "F" for failure, and
1868 "E" for error. The 421 reply (service not available, closing
1869 transmission channel) may be given to any command if the
1870 SMTP-receiver knows it must shut down. Since some servers may
1871 generate other replies under special circumstances, and to allow for
1872 future extension, SMTP clients SHOULD, when possible, interpret only
1873 the first digit of the reply and MUST be prepared to deal with
1874 unrecognized reply codes by interpreting the first digit only. SMTP
1875 servers MUST NOT transmit reply codes to an SMTP client that are
1876 other than three digits or that do not start in a digit between 2 and
1877 5 inclusive. This listing forms the basis for the State Diagrams in
1880 CONNECTION ESTABLISHMENT
1885 E: 500, 501, 504, 421
1891 S: 250, 251 (but see section ##<<<>>> for discussion of 251)
1892 F: 550, 551, 552, 553, 450, 451, 452
1893 E: 500, 501, 503, 421
1895 I: 354 -> data -> S: 250
1896 F: 552, 554, 451, 452
1898 E: 500, 501, 503, 421
1901 E: 500, 501, 504, 421
1905 E: 500, 501, 502, 421
1909 E: 500, 501, 502, 421
1913 E: 500, 501, 502, 421
1917 E: 500, 501, 502, 504, 421
1921 E: 500, 501, 502, 504, 421
1924 E: 500, 501, 502, 504, 421
1938 4.4 Trace information
1940 When an SMTP server receives a message for delivery or further
1941 processing, it MUST insert trace ("time stamp" or "Received"
1942 information at the beginning of the message body, as discussed under
1943 the DATA command in section ##4.1.1.4.
1945 This line must be structured as follows:
1947 * The FROM field SHOULD contain both (1) the name of the
1948 source host as presented in the EHLO or HELO command and (2) a
1949 domain literal containing the IP address of the source,
1950 determined from the TCP connection.
1952 * The ID field MAY contain an "@" as suggested in RFC-822,
1953 but this is not required.
1955 * The FOR field MAY contain a list of <path> entries when
1956 multiple RCPT commands have been given.
1958 An Internet mail program MUST NOT change a Received: line that was
1959 previously added to the message header.
1962 As the Internet grows, comparability of Received fields is important
1963 for detecting problems, especially slow relays. SMTP servers that
1964 create Received fields SHOULD use explicit offsets in the dates
1965 (e.g., -0800), rather than time zone names of any type. If it is
1966 desired to also use a time zone name, it should be included in a
1970 When the SMTP server makes the "final delivery" of a message it
1971 inserts a return-path line at the beginning of the mail data. This
1972 use of return-path is required; mail systems MUST support it. The
1973 return path line preserves the information in the <reverse-path> from
1974 the MAIL command. Here, final delivery means the message leaves the
1975 SMTP world. Normally, this would mean it has been delivered to the
1976 destination user, but in some cases it may be further processed and
1977 transmitted by another mail system.
1979 It is possible for the mailbox in the return path be different from
1980 the actual sender's mailbox, for example, if error responses are to
1981 be delivered a special error handling mailbox rather than to that of
1982 the message sender. When mailing lists are involved, this
1983 arrangement is common and useful as a means of directing errors to
1984 the list maintainer rather than the message originator.
1986 The preceding two paragraphs imply that the final mail data will
1987 begin with a return path line, followed by one or more time stamp
1988 lines. These lines will be followed by the mail data header and body
1989 [RFC822]. See Example 8.
1991 It is sometimes difficult for an SMTP server to determine whether or
1992 not it is making final delivery since forwarding or other operations
1993 may occur after the message is accepted for delivery. However any
1994 further (forwarding, gateway, or relay) systems MAY remove the return
1995 path and rebuild the MAIL FROM command as needed to ensure that
1996 exactly one such line appears in a delivered message.
1998 A message-originating SMTP system SHOULD NOT send a message that
1999 already contains a Return-path header. If a message that contains
2000 more than one Return-path header is received, only the first
2001 Return-path header line in the message header is valid. A message
2002 header processor SHOULD discard or, if necessary just ignore, any
2003 Return-path headers following the first one.
2005 The primary intent of the Return-path is that it designates the
2006 address to which messages indicating non-delivery or other mail
2007 system failures at to be sent. For this to be unambigious, exactly
2008 one return path should be present when the message is delivered.
2009 Systems using RFC 822 syntax with non-SMTP transports SHOULD preserve
2010 the intent of having an unambiguous address, associated with the
2011 transport envelope, to which to send error reports (e.g.,
2012 non-delivery messages).
2014 Historical note: Text in RFC 822 that appears to contradict the
2015 use of Return-path (or the envelope MAIL FROM address) as the
2016 destination of error messages is not applicable on the Internet.
2017 The MAIL FROM address (as copied into the Return-path) MUST be
2018 used as the target of any mail containing delivery error messages.
2022 (i) a gateway from SMTP->elsewhere SHOULD insert a return-path
2023 header, unless it is known that the "elsewhere" transport
2024 also uses Internet domain addresses and maintains the
2025 envelope sender address separately.
2027 (ii) a gateway from elsewhere->SMTP SHOULD delete any
2028 return-path header present in the message, and either copy
2029 that information to the SMTP envelope or combine it with
2030 information present in the envelope of the other transport
2031 system to construct the MAIL FROM part of the SMTP envelope.
2034 Special mention is needed of the response and further action required
2035 when the processing following the end of mail data indication is
2036 partially successful. This could arise if after accepting several
2037 recipients and the mail data, the SMTP server finds that the mail
2038 data can be successfully delivered to some of the recipients, but it
2039 cannot be to others (for example, due to mailbox space allocation
2040 problems). In such a situation, the response to the DATA command
2041 must be an OK reply. But, the SMTP server must compose and send an
2042 "undeliverable mail" notification message to the originator of the
2043 message. Either a single notification which lists all of the
2044 recipients that failed to get the message, or separate notification
2045 messages must be sent for each failed recipient (see Example 7). All
2046 undeliverable mail notification messages are sent using the MAIL
2047 command (even if they result from processing a SEND, SOML, or SAML
2053 -------------------------------------------------------------
2055 | Example of Return Path and Received Time Stamps
2057 | Return-Path: <@GHI.ARPA,@DEF.ARPA,@ABC.ARPA:JOE@ABC.ARPA>
2058 | Received: from GHI.ARPA by JKL.ARPA ; 27 Oct 81 15:27:39 -0800
2059 | Received: from DEF.ARPA by GHI.ARPA ; 27 Oct 81 15:15:13 -0800
2060 | Received: from ABC.ARPA by DEF.ARPA ; 27 Oct 81 15:01:59 -0800
2061 | Date: 27 Oct 81 15:01:01 -0800 (PST)
2062 | From: JOE@ABC.ARPA
2063 | Subject: Improved Mailing System Installed
2066 | This is to inform you that ...
2070 -------------------------------------------------------------
2079 Following are state diagrams for a simple-minded SMTP
2080 implementation. Only the first digit of the reply codes is used.
2081 There is one state diagram for each group of SMTP commands. The
2082 command groupings were determined by constructing a model for each
2083 command and then collecting together the commands with
2084 structurally identical models.
2086 For each command there are three possible outcomes: "success"
2087 (S), "failure" (F), and "error" (E). In the state diagrams below
2088 we use the symbol B for "begin", and the symbol W for "wait for
2091 First, the diagram that represents most of the SMTP commands:
2098 +---+ cmd +---+ 2 +---+
2099 | B |---------->| W |---------->| S |
2107 This diagram models the commands:
2109 HELO, EHLO, MAIL, RCPT, RSET, SEND, SOML, SAML, VRFY, EXPN,
2110 HELP, NOOP, QUIT, TURN.
2115 A more complex diagram models the DATA command:
2118 +---+ DATA +---+ 1,2 +---+
2119 | B |---------->| W |-------------------->| E |
2120 +---+ +---+ ------------>+---+
2123 -------------- ----- |
2125 | ---------- -------->| S |
2130 +---+ data +---+ --------------->+---+
2131 | |---------->| W | | F |
2132 +---+ +---+-------------------->+---+
2136 Note that the "data" here are a series of lines sent from the
2137 sender to the receiver with no response expected until the last
2143 4.6.1. MINIMUM IMPLEMENTATION
2145 In order to make SMTP workable, the following minimum
2146 implementation is required for all receivers:
2157 Any system that includes an SMTP server that supports RCPT MUST
2158 support the reserved mailbox "Postmaster" as a case-insensitive
2159 mailbox name. EHLO SHOULD be supported if possible.
2165 Without some provision for data transparency the character
2166 sequence "<CRLF>.<CRLF>" ends the mail text and cannot be sent
2167 by the user. In general, users are not aware of such
2168 "forbidden" sequences. To allow all user composed text to be
2169 transmitted transparently the following procedures are used.
2171 1. Before sending a line of mail text the SMTP client checks
2172 the first character of the line. If it is a period, one
2173 additional period is inserted at the beginning of the line.
2175 2. When a line of mail text is received by the SMTP server
2176 it checks the line. If the line is composed of a single
2177 period it is the end of mail. If the first character is a
2178 period and there are other characters on the line, the first
2179 character is deleted.
2181 The mail data may contain any of the 128 ASCII characters. All
2182 characters are to be delivered to the recipient's mailbox
2183 including format effectors and other control characters. If
2184 the transmission channel provides an 8-bit byte (octets) data
2185 stream, the 7-bit ASCII codes are transmitted right justified
2186 in the octets with the high order bits cleared to zero.
2188 In some systems it may be necessary to transform the data as
2189 it is received and stored. This may be necessary for hosts
2190 that use a different character set than ASCII as their local
2191 character set, or that store data in records rather than
2192 strings. If such transforms are necessary, they must be
2193 reversible -- especially if such transforms are applied to
2197 4.6.3. SIZES AND TIMEOUTS
2199 There are several objects that have required minimum maximum
2200 sizes. That is, every implementation must be able to receive
2201 objects of at least these sizes, but must not send objects
2202 larger than these sizes.
2205 ****************************************************
2207 * TO THE MAXIMUM EXTENT POSSIBLE, IMPLEMENTATION *
2208 * TECHNIQUES WHICH IMPOSE NO LIMITS ON THE LENGTH *
2209 * OF THESE OBJECTS SHOULD BE USED. *
2211 ****************************************************
2215 The maximum total length of a user name is 64 characters.
2219 The maximum total length of a domain name or number is 64
2224 The maximum total length of a reverse-path or
2225 forward-path is 256 characters (including the punctuation
2226 and element separators).
2230 The maximum total length of a command line including the
2231 command word and the <CRLF> is 512 characters.
2235 The maximum total length of a reply line including the
2236 reply code and the <CRLF> is 512 characters.
2241 The maximum total length of a text line including the
2242 <CRLF> is 1000 characters (but not counting the leading
2243 dot duplicated for transparency). This number may be increased by
2244 the use of SMTP Service Extensions.
2248 The maximum total length of a message body (including any message
2249 headers) MUST BE at least 64K octets. Especially since the
2250 introduction of multimedia mail [RFC-MIME], message lengths on the
2251 Internet have grown dramatically, and message size restrictions
2252 should be avoided if at all possible. SMTP server systems that must
2253 impose restrictions SHOULD implement the "SIZE" service extension
2254 ([RFC-SIZE]) and SMTP client systems that will send large messages
2255 SHOULD utilize it when possible.
2259 The maximum total number of recipients that must be
2260 buffered is 100 recipients.
2263 ****************************************************
2265 * TO THE MAXIMUM EXTENT POSSIBLE, IMPLEMENTATION *
2266 * TECHNIQUES WHICH IMPOSE NO LIMITS ON THE LENGTH *
2267 * OF THESE OBJECTS SHOULD BE USED. *
2269 ****************************************************
2271 Errors due to exceeding these limits may be reported by using
2272 the reply codes, for example:
2278 552 Too many recipients.
2280 552 Too much mail data.
2283 An SMTP client should provide timeouts for all commands. Minimum
2284 values SHOULD be as follows:
2286 o Initial 220 Message: 5 minutes
2288 An SMTP client process needs to distinguish between a
2289 failed TCP connection and a delay in receiving the initial
2290 220 greeting message. Many SMTP servers will accept a
2291 TCP connection but delay delivery of the 220 message until
2292 their system load will permit more mail to be processed.
2294 o MAIL Command: 5 minutes
2297 o RCPT Command: 5 minutes
2299 A longer timeout would be required if processing of
2300 mailing lists and aliases were not deferred until after
2301 the message was accepted.
2303 o DATA Initiation: 2 minutes
2305 This is while awaiting the "354 Start Input" reply to a
2308 o Data Block: 3 minutes
2310 This is while awaiting the completion of each TCP SEND
2311 call transmitting a chunk of data.
2313 o DATA Termination: 10 minutes.
2315 This is while awaiting the "250 OK" reply. When the
2316 receiver gets the final period terminating the message
2317 data, it typically performs processing to deliver the
2318 message to a user mailbox. A spurious timeout at this
2319 point would be very wasteful, since the message has been
2322 An SMTP server SHOULD have a timeout of at least 5 minutes
2323 while it is awaiting the next command from the sender.
2326 4.6.4 Queuing Strategies
2328 The common structure of a host SMTP implementation includes
2329 user mailboxes, one or more areas for queueing messages in
2330 transit, and one or more daemon processes for sending and
2331 receiving mail. The exact structure will vary depending on the
2332 needs of the users on the host and the number and size of
2333 mailing lists supported by the host. We describe several
2334 optimizations that have proved helpful, particularly for
2335 mailers supporting high traffic levels.
2337 Any queueing strategy MUST include:
2339 o Timeouts on all activities on a per-command basis
2341 o Never sending error messages in response to error messages.
2344 4.6.4.1 Sending Strategy
2346 The general model of an SMTP client is one or more processes
2347 that periodically attempt to transmit outgoing mail. In a
2348 typical system, the program that composes a message has some
2349 method for requesting immediate attention for a new piece of
2350 outgoing mail, while mail that cannot be transmitted
2351 immediately MUST be queued and periodically retried by the
2352 sender. A mail queue entry will include not only the
2353 message itself but also the envelope information.
2355 The sender MUST delay retrying a particular destination
2356 after one attempt has failed. In general, the retry
2357 interval SHOULD be at least 30 minutes; however, more
2358 sophisticated and variable strategies will be beneficial
2359 when the SMTP client can determine the reason for non-
2362 Retries continue until the message is transmitted or the
2363 sender gives up; the give-up time generally needs to be at
2364 least 4-5 days. The parameters to the retry algorithm MUST
2367 A sender SHOULD keep a list of hosts it cannot reach and
2368 corresponding connection timeouts, rather than just retrying queued
2372 Experience suggests that failures are typically
2373 transient (the target system has crashed), favoring a
2374 policy of two connection attempts in the first hour the
2375 message is in the queue, and then backing off to once
2376 every two or three hours.
2378 The SMTP client can shorten the queueing delay by
2379 cooperation with the SMTP server. In particular, if
2380 mail is received from a particular address, it is good
2381 evidence that any mail queued for that host can now be
2384 The strategy may be further modified as a result of
2385 multiple addresses per host (see Section ##5.??.??), to
2386 optimize delivery time vs. resource usage.
2388 an SMTP client may have a large queue of messages for
2389 each unavailable destination host, and if it retried
2390 all these messages in every retry cycle, there would be
2391 excessive Internet overhead and the daemon would be
2392 blocked for a long period. Note that an SMTP can
2393 generally determine that a delivery attempt has failed
2394 only after a timeout of a minute or more; a one minute
2395 timeout per connection will result in a very large
2396 delay if it is repeated for dozens or even hundreds of
2399 When the same message is to be delivered to several users on
2400 the same host, only one copy of the message SHOULD be
2401 transmitted. That is, the SMTP client should use the
2402 command sequence: RCPT, RCPT,... RCPT, DATA instead of the
2403 sequence: RCPT, DATA, RCPT, DATA,... RCPT, DATA.
2404 Implementation of this efficiency feature is strongly urged.
2406 Similarly, the SMTP client MAY support multiple concurrent
2407 outgoing mail transactions to achieve timely delivery.
2408 However, some limit SHOULD be imposed to protect the host
2409 from devoting all its resources to mail.
2411 4.6.4.2 Receiving strategy
2413 The SMTP server SHOULD attempt to keep a pending listen on
2414 the SMTP port at all times. This will require the support
2415 of multiple incoming TCP connections for SMTP. Some limit
2419 When the SMTP server receives mail from a particular
2420 host address, it could notify the SMTP client to retry
2421 any mail pending for that host address.
2424 5. Address resolution and mail handling
2426 Once an SMTP client lexically identifies a domain to which mail is to
2427 be delivered for processing (as described in sections ##3.6 and
2428 ##3.7), a DNS lookup is performed to resolve that domain name (see
2429 [RFC-DNS]). The lookup first attempts to locate an MX record
2430 associated with that name. If a CNAME record is found instead, the
2431 resulting name is processed as if it were the initial name.
2433 When the lookup succeeds, the mapping can result in a list of
2434 alternative delivery addresses rather than a single address, because
2435 of (a) multiple MX records, (b) multihoming, or both. To provide
2436 reliable mail transmission, the SMTP client MUST be able to try (and
2437 retry) each of the addresses in this list in order, until a delivery
2438 attempt succeeds. However, there MAY also be a configurable limit on
2439 the number of alternate addresses that can be tried. In any case, a
2440 host SHOULD try at least two addresses.
2442 The following information is to be used to rank the host
2445 (1) Multiple MX Records -- these contain a preference
2446 indication that should be used in sorting. If there are
2447 multiple destinations with the same preference and there
2448 is no clear reason to favor one (e.g., by address
2449 preference), then the sender-SMTP SHOULD pick one at
2450 random to spread the load across multiple mail exchanges
2451 for a specific organization; note that this is a
2452 refinement of the procedure in [DNS:3].
2454 (2) Multihomed host -- The destination host (perhaps taken
2455 from the preferred MX record) may be multihomed, in which
2456 case the domain name resolver will return a list of
2457 alternative IP addresses. It is the responsibility of the
2458 domain name resolver interface to have ordered this list by
2459 decreasing preference, and SMTP MUST try them in the order
2463 Although the capability to try multiple alternative
2464 addresses is required, there may be circumstances where
2465 specific installations want to limit or disable the use of
2466 alternative addresses. The question of whether a sender
2467 should attempt retries using the different addresses of a
2468 multihomed host has been controversial. The main argument
2469 for using the multiple addresses is that it maximizes the
2470 probability of timely delivery, and indeed sometimes the
2471 probability of any delivery; the counter argument is that
2472 it may result in unnecessary resource use.
2474 Note that resource use is also strongly determined by the
2475 sending strategy discussed in Section #??.??.??
2479 6. Problem detection and handling
2481 6.1 Replies by email
2487 Simple counting of the number of Received lines in a message has not
2488 proven to be a desirable method of detecting loops in mail systems,
2489 and SMTP servers SHOULD NOT use that technique. Loop detection by
2490 examination of Received fields for the domain name or other signature
2491 of the SMTP server making the check is effective and MAY be used by
2496 7. Security Considerations
2498 7.1 Mail security and spoofing
2500 SMTP mail is inherently insecure in that it is feasible for even
2501 fairly casual users to negotiate directly with receiving and
2502 relaying SMTP servers and create messages that will trick a
2503 naive recipient into believing that they came from somewhere
2504 else. Constructing such a message so that the "spoofed"
2505 behavior cannot be detected by an expert is somewhat more
2506 difficult, but not sufficiently so as to be a deterrent to
2507 someone who is determined and knowledgeable.
2509 Consequently, as knowledge of Internet mail increases, so does the
2510 knowledge that SMTP mail inherently cannot be authenticated, or
2511 integrity checks provided, at the transport level. Real security
2512 lies only in end-to-end methods involving the message bodies, e.g.,
2513 those that can be provided in the MOSS framework [RFC-MOSS].
2515 A corollary to this is that efforts to make it more difficult
2516 for users to set envelope MAIL FROM and header "From" fields
2517 to point to valid addresses other than their own are largely
2518 misguided: they do not prevent any would-be mail spoofer from
2519 doing so, and do frustrate legitimate applications in which
2520 mail is sent by one user on behalf of another or in which
2521 error (or normal) replies should be directed to a special
2522 address. On the other hand, systems that provide convenient
2523 ways for users to alter these fields on a per-message basis
2524 should attempt to establish a primary and permanent mailbox
2525 address for the user so that Sender fields can be generated
2528 This specification does not further address the security issues
2529 associated with SMTP other than to advocate that useful
2530 functionality not be disabled in the hope of providing some
2531 small margin of protection against an ignorant user who is
2532 trying to fake mail.
2538 Addresses may appear in the RCPT TO commands to an SMTP server
2539 that do not appear in the message headers for a number of
2540 reasons. The two most common of these involve the use of a
2541 mailing address as a "list exploder" -- a single address that
2542 resolves into multiple addresses -- and the appearance of "blind
2543 copies". In order to avoid defeating some of the purpose of
2544 these mechanisms, SMTP clients and servers SHOULD NOT copy the
2545 RCPT TO command arguments into the headers, even as
2546 informational or private-extension headers. Since this rule is
2547 often violated in practice, and cannot be enforced, sending SMTP
2548 systems that are aware of "bcc" use MAY find it helpful to send
2549 each blind copy as a separate message transaction containing
2550 only a single RCPT TO command.
2552 More generally, while there are often similarities, there is no
2553 inherent relationship between either "reverse" (MAIL FROM, SAML FROM,
2554 etc.) or "forward" (RCPT TO) addresses in the SMTP transaction
2555 ("envelope") and the addresses in the headers. Receiving systems
2556 SHOULD NOT attempt to deduce such relationships and use them to alter
2557 the headers of the message for delivery. The popular "Apparently-to"
2558 header is a violation of this principle and SHOULD NOT be used.
2560 See also section ##2.2.4.
2567 ASCII, "USA Code for Information Interchange", United States of
2568 America Standards Institute, X3.4, 1968.
2571 Crocker, D., "Standard for the Format of ARPA Internet Text
2572 Messages", RFC 822, Department of Electrical Engineering,
2573 University of Delaware, August 1982.
2576 Postel, J., ed., "Transmission Control Protocol - DARPA Internet
2577 Program Protocol Specification", RFC 793, USC/Information Sciences
2578 Institute, NTIS AD Number A111091, September 1981. Also in:
2579 Feinler, E. and J. Postel, eds., "Internet Protocol Transition
2580 Workbook", SRI International, Menlo Park, California, March 1982.
2584 [RFC-DNS] P. Mockapetris, "Domain names - implementation and
2585 specification", RFC 1035 and P. Mockapetris, "Domain names -
2586 concepts and facilities", RFC 1034. (STD 13)
2588 [RFC 974] C. Partridge, "Mail routing and the domain system",
2591 [SMTPEX] J. Klensin, N. Freed, M. Rose, E. Stefferud, D.
2592 Crocker, "SMTP Service Extensions", RFC-1869, 11/06/1995.
2594 [RFC-1123] R. Braden, "Requirements for Internet hosts -
2595 application and support", 10/01/1989
2597 [RFC-MOSS] S. Crocker, N. Freed, J. Galvin, S. Murphy, "MIME Object
2598 Security Services", RFC 1848, 10/03/1995.
2600 [RFC-POP2] M. Butler, D. Chase, J. Goldberger, J. Postel, J.
2601 Reynolds, "Post Office Protocol - version 2", RFC 937,
2604 [RFC-POP3] J. Myers, M. Rose, "Post Office Protocol - Version 3",
2605 RFC 1725, 11/23/1994.
2607 [RFC-IMAP4] M. Crispin, "Internet Message Access Protocol
2608 - Version 4", RFC 1730, 12/20/1994.
2610 [ABNF] Crocker, D., "Augmented BNF for Syntax Specifictions" (sic),
2611 (in progress -- draft-ietf-drums-abnf-00.txt)
2614 9. Editor's Addresses
2618 800 Boylston St, 7th floor
2621 Email: Klensin@mci.net
2622 Phone: +1 617 859 1011
2623 Fax: +1 617 859 1011
2626 10. Acknowledgements
2633 TCP Transport service
2635 The Transmission Control Protocol [3] is used in the Internet, and in
2636 any network following the Internet standards for internetwork protocols.
2638 Connection Establishment
2640 The SMTP transmission channel is a TCP connection established
2641 between the sender process port U and the receiver process port
2642 L. This single full duplex connection is used as the
2643 transmission channel. This protocol is assigned the service
2644 port 25 (31 octal), that is L=25.
2648 The TCP connection supports the transmission of 8-bit bytes.
2649 The SMTP data is 7-bit ASCII characters. Each character is
2650 transmitted as an 8-bit byte with the high-order bit cleared to
2656 Generating SMTP commands from RFC 822 headers
2658 Some systems use RFC 822 headers (only) in a mail submission
2659 protocol, or otherwise generate SMTP commands from RFC 822 headers
2660 when such a message is handed to an MTA from a UA. While the MTA-UA
2661 protocol is a private matter, not covered by any Internet Standard,
2662 there are problems with this approach. For example, there have been
2663 repeated problems with proper handling of "bcc" copies and
2664 redistribution lists when information that conceptually belongs to a
2665 mail envelopes is not separated early in processing from header
2666 information (and kept separate).
2668 It is recommended that the UA provide its initial MTA with an
2669 envelope separate from the message itself. However, if the envelope
2670 is not supplied, SMTP commands should be generated as follows:
2672 (i) each recipient addresses from a TO, CC, or BCC header field
2673 should be copied to a RCPT command (generating multiple message
2674 copies if that is required for queuing or delivery). This includes
2675 any addresses listed in a RFC 822 "group". Any BCC fields should
2676 then be removed from the headers. Once this process is completed,
2677 the remaining headers should be checked to verify that at least one
2678 To:, Cc:, or Bcc: header remains. If none do, then a bcc: header
2679 with no additional information SHOULD be inserted (see section ##2.15
2682 (ii) the return address in the MAIL command should be derived from
2683 the system's identity for the submitting (local) user. That return
2684 address should also be copied to the Sender header field if it is
2685 different from the address in the From header field. (Any Sender
2686 field that was already there should be removed.) Systems may provide
2687 a way for submitters to override the envelope return address, but may
2688 want to restrict its use to privileged users. (This will not prevent
2689 mail forgery, but may lessen its incidence.)
2691 A submission protocol based on Standard RFC 822 information alone
2692 MUST NOT be used to gateway a message from a foreign (non-SMTP) mail
2693 system into an SMTP environment. Additional information to construct
2694 an envelope must come from some source in the other environment,
2695 whether supplemental headers or the foreign system's envelope.
2697 Attempts to gateway messages using only their header "to" and "cc"
2698 fields, have repeatedly caused mail loops and other behavior adverse
2699 to the proper functioning of the Internet mail environment. These
2700 problems have been especially common when the message originates from
2701 an Internet mailing list and is distributed into the foreign
2702 environment using envelope information. When these messages are then
2703 processed by a header-only remailer, loops back to the Internet
2704 environment (and the mailing list) are almost inevitable.
2709 Theory of Reply Codes
2711 The three digits of the reply each have a special significance.
2712 The first digit denotes whether the response is good, bad or
2713 incomplete. An unsophisticated SMTP client will be able to
2714 determine its next action (proceed as planned, redo, retrench,
2715 etc.) by simply examining this first digit. An SMTP client that
2716 wants to know approximately what kind of error occurred (e.g.,
2717 mail system error, command syntax error) may examine the second
2718 digit, reserving the third digit for the finest gradation of
2721 There are five values for the first digit of the reply code:
2723 1yz Positive Preliminary reply
2725 The command has been accepted, but the requested action
2726 is being held in abeyance, pending confirmation of the
2727 information in this reply. The SMTP client should send
2728 another command specifying whether to continue or abort
2731 [Note: SMTP does not have any commands that allow this
2732 type of reply, and so does not have the continue or
2735 2yz Positive Completion reply
2737 The requested action has been successfully completed. A
2738 new request may be initiated.
2740 3yz Positive Intermediate reply
2742 The command has been accepted, but the requested action
2743 is being held in abeyance, pending receipt of further
2744 information. The SMTP client should send another command
2745 specifying this information. This reply is used in
2746 command sequence groups.
2748 4yz Transient Negative Completion reply
2750 The command was not accepted and the requested action did
2751 not occur. However, the error condition is temporary and
2752 the action may be requested again. The sender should
2753 return to the beginning of the command sequence (if any).
2754 It is difficult to assign a meaning to "transient" when
2755 two different sites (receiver- and sender- SMTPs) must
2756 agree on the interpretation. Each reply in this category
2757 might have a different time value, but the SMTP client is
2758 encouraged to try again. A rule of thumb to determine if
2759 a reply fits into the 4yz or the 5yz category (see below)
2760 is that replies are 4yz if they can be repeated without
2761 any change in command form or in properties of the sender
2762 or receiver. (E.g., the command is repeated identically
2763 and the receiver does not put up a new implementation.)
2765 5yz Permanent Negative Completion reply
2767 The command was not accepted and the requested action did
2768 not occur. The SMTP client is discouraged from repeating
2769 the exact request (in the same sequence). Even some
2770 "permanent" error conditions can be corrected, so the
2771 human user may want to direct the SMTP client to
2772 reinitiate the command sequence by direct action at some
2773 point in the future (e.g., after the spelling has been
2774 changed, or the user has altered the account status).
2776 The second digit encodes responses in specific categories:
2778 x0z Syntax -- These replies refer to syntax errors,
2779 syntactically correct commands that don't fit any
2780 functional category, and unimplemented or superfluous
2783 x1z Information -- These are replies to requests for
2784 information, such as status or help.
2786 x2z Connections -- These are replies referring to the
2787 transmission channel.
2789 x3z Unspecified as yet.
2791 x4z Unspecified as yet.
2793 x5z Mail system -- These replies indicate the status of
2794 the receiver mail system vis-a-vis the requested
2795 transfer or other mail system action.
2797 The third digit gives a finer gradation of meaning in each
2798 category specified by the second digit. The list of replies
2799 illustrates this. Each reply text is recommended rather than
2800 mandatory, and may even change according to the command with
2801 which it is associated. On the other hand, the reply codes
2802 must strictly follow the specifications in this section.
2803 Receiver implementations should not invent new codes for
2804 slightly different situations from the ones described here, but
2805 rather adapt codes already defined.
2807 For example, a command such as NOOP whose successful execution
2808 does not offer the SMTP client any new information will return
2809 a 250 reply. The response is 502 when the command requests an
2810 unimplemented non-site-specific action. A refinement of that
2811 is the 504 reply for a command that is implemented, but that
2812 requests an unimplemented parameter.
2814 The reply text may be longer than a single line; in these cases
2815 the complete text must be marked so the SMTP client knows when it
2816 can stop reading the reply. This requires a special format to
2817 indicate a multiple line reply.
2819 The format for multiline replies requires that every line,
2820 except the last, begin with the reply code, followed
2821 immediately by a hyphen, "-" (also known as minus), followed by
2822 text. The last line will begin with the reply code, followed
2823 immediately by <SP>, optionally some text, and <CRLF>.
2828 123-234 text beginning with numbers
2831 In many cases the SMTP client then simply needs to search for
2832 the reply code followed by <SP> at the beginning of a line, and
2833 ignore all preceding lines. In a few cases, there is important
2834 data for the sender in the reply "text". The sender will know
2835 these cases from the current context.
2842 This section presents complete scenarios of several types of SMTP
2845 A Typical SMTP Transaction Scenario
2847 This SMTP example shows mail sent by Smith at host USC-ISIF, to
2848 Jones, Green, and Brown at host BBN-UNIX. Here we assume that
2849 host USC-ISIF contacts host BBN-UNIX directly. The mail is
2850 accepted for Jones and Brown. Green does not have a mailbox at
2853 -------------------------------------------------------------
2855 R: 220 BBN-UNIX.ARPA Simple Mail Transfer Service Ready
2856 S: HELO USC-ISIF.ARPA
2857 R: 250 BBN-UNIX.ARPA
2859 S: MAIL FROM:<Smith@USC-ISIF.ARPA>
2862 S: RCPT TO:<Jones@BBN-UNIX.ARPA>
2865 S: RCPT TO:<Green@BBN-UNIX.ARPA>
2866 R: 550 No such user here
2868 S: RCPT TO:<Brown@BBN-UNIX.ARPA>
2872 R: 354 Start mail input; end with <CRLF>.<CRLF>
2873 S: Blah blah blah...
2874 S: ...etc. etc. etc.
2879 R: 221 BBN-UNIX.ARPA Service closing transmission channel
2883 -------------------------------------------------------------
2889 Aborted SMTP Transaction Scenario
2891 -------------------------------------------------------------
2893 R: 220 MIT-Multics.ARPA Simple Mail Transfer Service Ready
2894 S: HELO ISI-VAXA.ARPA
2895 R: 250 MIT-Multics.ARPA
2897 S: MAIL FROM:<Smith@ISI-VAXA.ARPA>
2900 S: RCPT TO:<Jones@MIT-Multics.ARPA>
2903 S: RCPT TO:<Green@MIT-Multics.ARPA>
2904 R: 550 No such user here
2910 R: 221 MIT-Multics.ARPA Service closing transmission channel
2914 -------------------------------------------------------------
2918 Relayed Mail Scenario
2920 -------------------------------------------------------------
2922 Step 1 -- Source Host to Relay Host
2924 R: 220 USC-ISIE.ARPA Simple Mail Transfer Service Ready
2926 R: 250 USC-ISIE.ARPA
2928 S: MAIL FROM:<JQP@MIT-AI.ARPA>
2931 S: RCPT TO:<@USC-ISIE.ARPA:Jones@BBN-VAX.ARPA>
2935 R: 354 Start mail input; end with <CRLF>.<CRLF>
2936 S: Date: 2 Nov 81 22:33:44
2937 S: From: John Q. Public <JQP@MIT-AI.ARPA>
2938 S: Subject: The Next Meeting of the Board
2939 S: To: Jones@BBN-Vax.ARPA
2942 S: The next meeting of the board of directors will be
2949 R: 221 USC-ISIE.ARPA Service closing transmission channel
2952 Step 2 -- Relay Host to Destination Host
2954 R: 220 BBN-VAX.ARPA Simple Mail Transfer Service Ready
2955 S: HELO USC-ISIE.ARPA
2958 S: MAIL FROM:<@USC-ISIE.ARPA:JQP@MIT-AI.ARPA>
2961 S: RCPT TO:<Jones@BBN-VAX.ARPA>
2965 R: 354 Start mail input; end with <CRLF>.<CRLF>
2966 S: Received: from MIT-AI.ARPA by USC-ISIE.ARPA ;
2967 2 Nov 81 22:40:10 UT
2968 S: Date: 2 Nov 81 22:33:44
2969 S: From: John Q. Public <JQP@MIT-AI.ARPA>
2970 S: Subject: The Next Meeting of the Board
2971 S: To: Jones@BBN-Vax.ARPA
2974 S: The next meeting of the board of directors will be
2981 R: 221 USC-ISIE.ARPA Service closing transmission channel
2985 -------------------------------------------------------------
2990 Verifying and Sending Scenario
2992 -------------------------------------------------------------
2994 R: 220 SU-SCORE.ARPA Simple Mail Transfer Service Ready
2996 R: 250 SU-SCORE.ARPA
2999 R: 250 Mark Crispin <Admin.MRC@SU-SCORE.ARPA>
3001 S: SEND FROM:<EAK@MIT-MC.ARPA>
3004 S: RCPT TO:<Admin.MRC@SU-SCORE.ARPA>
3008 R: 354 Start mail input; end with <CRLF>.<CRLF>
3009 S: Blah blah blah...
3010 S: ...etc. etc. etc.
3015 R: 221 SU-SCORE.ARPA Service closing transmission channel
3019 -------------------------------------------------------------
3024 Mailing List Scenario
3026 First each of two mailing lists are expanded in separate sessions
3027 with different hosts. Then the message is sent to everyone that
3028 appeared on either list (but no duplicates) via a relay host.
3030 -------------------------------------------------------------
3032 Step 1 -- Expanding the First List
3034 R: 220 MIT-AI.ARPA Simple Mail Transfer Service Ready
3035 S: HELO SU-SCORE.ARPA
3038 S: EXPN Example-People
3039 R: 250-<ABC@MIT-MC.ARPA>
3040 R: 250-Fred Fonebone <Fonebone@USC-ISIQ.ARPA>
3041 R: 250-Xenon Y. Zither <XYZ@MIT-AI.ARPA>
3042 R: 250-Quincy Smith <@USC-ISIF.ARPA:Q-Smith@ISI-VAXA.ARPA>
3043 R: 250-<joe@foo-unix.ARPA>
3044 R: 250 <xyz@bar-unix.ARPA>
3047 R: 221 MIT-AI.ARPA Service closing transmission channel
3050 Step 2 -- Expanding the Second List
3052 R: 220 MIT-MC.ARPA Simple Mail Transfer Service Ready
3053 S: HELO SU-SCORE.ARPA
3056 S: EXPN Interested-Parties
3057 R: 250-Al Calico <ABC@MIT-MC.ARPA>
3058 R: 250-<XYZ@MIT-AI.ARPA>
3059 R: 250-Quincy Smith <@USC-ISIF.ARPA:Q-Smith@ISI-VAXA.ARPA>
3060 R: 250-<fred@BBN-UNIX.ARPA>
3061 R: 250 <xyz@bar-unix.ARPA>
3064 R: 221 MIT-MC.ARPA Service closing transmission channel
3067 Step 3 -- Mailing to All via a Relay Host
3069 R: 220 USC-ISIE.ARPA Simple Mail Transfer Service Ready
3070 S: HELO SU-SCORE.ARPA
3071 R: 250 USC-ISIE.ARPA
3073 S: MAIL FROM:<Account.Person@SU-SCORE.ARPA>
3075 S: RCPT TO:<@USC-ISIE.ARPA:ABC@MIT-MC.ARPA>
3077 S: RCPT TO:<@USC-ISIE.ARPA:Fonebone@USC-ISIQA.ARPA>
3079 S: RCPT TO:<@USC-ISIE.ARPA:XYZ@MIT-AI.ARPA>
3082 TO:<@USC-ISIE.ARPA,@USC-ISIF.ARPA:Q-Smith@ISI-VAXA.ARPA>
3084 S: RCPT TO:<@USC-ISIE.ARPA:joe@FOO-UNIX.ARPA>
3086 S: RCPT TO:<@USC-ISIE.ARPA:xyz@BAR-UNIX.ARPA>
3088 S: RCPT TO:<@USC-ISIE.ARPA:fred@BBN-UNIX.ARPA>
3092 R: 354 Start mail input; end with <CRLF>.<CRLF>
3093 S: Blah blah blah...
3094 S: ...etc. etc. etc.
3099 R: 221 USC-ISIE.ARPA Service closing transmission channel
3103 -------------------------------------------------------------
3107 Too Many Recipients Scenario
3109 -------------------------------------------------------------
3111 R: 220 BERKELEY.ARPA Simple Mail Transfer Service Ready
3112 S: HELO USC-ISIF.ARPA
3113 R: 250 BERKELEY.ARPA
3115 S: MAIL FROM:<Postel@USC-ISIF.ARPA>
3118 S: RCPT TO:<fabry@BERKELEY.ARPA>
3121 S: RCPT TO:<eric@BERKELEY.ARPA>
3122 R: 552 Recipient storage full, try again in another transaction
3125 R: 354 Start mail input; end with <CRLF>.<CRLF>
3126 S: Blah blah blah...
3127 S: ...etc. etc. etc.
3131 S: MAIL FROM:<Postel@USC-ISIF.ARPA>
3134 S: RCPT TO:<eric@BERKELEY.ARPA>
3138 R: 354 Start mail input; end with <CRLF>.<CRLF>
3139 S: Blah blah blah...
3140 S: ...etc. etc. etc.
3145 R: 221 BERKELEY.ARPA Service closing transmission channel
3149 -------------------------------------------------------------
3151 Note that a real implementation must handle many recipients as
3152 specified in Section ##4.5.3.
3155 APPENDIX G Other gateway issues.
3157 In general, gateways between the Internet and other mail systems
3158 SHOULD attempt to preserve any layering semantics across the
3159 boundaries between the two mail systems involved. Gateway-
3160 translation approaches that attempt to take shortcuts by
3161 mapping, e.g., envelope information from one system to the
3162 message headers or body of another have generally proven to be
3163 inadequate in important ways. Systems translating between
3164 environments that do not support both envelopes and headers and
3165 Internet mail must be written with the understanding that some
3166 information loss is almost inevitable.
3175 American Standard Code for Information Interchange [1].
3179 A request for a mail service action sent by the SMTP client to the
3184 The hierarchially structured global character string address of a
3185 host computer in the mail system.
3187 end of mail data indication
3189 A special sequence of characters that indicates the end of the
3190 mail data. In particular, the five characters carriage return,
3191 line feed, period, carriage return, line feed, in that order.
3195 A computer in the internetwork environment on which mailboxes or
3196 SMTP processes reside.
3200 A a sequence of ASCII characters ending with a <CRLF>.
3204 A sequence of ASCII characters of arbitrary length, which conforms
3205 to the standard set in the Standard for the Format of ARPA
3206 Internet Text Messages (RFC 822 [RFC822]).
3210 A character string (address) which identifies a user to whom mail
3211 is to be sent. Mailbox normally consists of the host and user
3212 specifications. The standard mailbox naming convention is defined
3213 to be "user@domain". Additionally, the "container" in which mail
3219 A process which transfers mail in cooperation with an SMTP client
3220 process. It waits for a connection to be established via the
3221 transport service. It receives SMTP commands from the
3222 SMTP client, sends replies, and performs the specified operations.
3226 A reply is an acknowledgment (positive or negative) sent from
3227 receiver to sender via the transmission channel in response to a
3228 command. The general form of a reply is a completion code
3229 (including error codes) followed by a text string. The codes are
3230 for use by programs and the text is usually intended for human
3235 A process which transfers mail in cooperation with an SMTP server
3236 process. A local language may be used in the user interface
3237 command/reply dialogue. The SMTP client initiates the transport
3238 service connection. It initiates SMTP commands, receives replies,
3239 and governs the transfer of mail.
3243 The set of exchanges that occur while the transmission channel is
3248 The set of exchanges required for one message to be transmitted
3249 for one or more recipients.
3251 transmission channel
3253 A full-duplex communication path between an SMTP client and a
3254 SMTP server for the exchange of commands, replies, and mail
3259 Any reliable stream-oriented data communication services. For
3260 example, NCP, TCP, NITS.
3265 A human being (or a process on behalf of a human being) wishing to
3266 obtain mail transfer service. In addition, a recipient of
3271 A sequence of printing characters.
3275 The characters carriage return and line feed (in that order).
3279 The space character.
3281 APPENDIX I: Deprecated features of RFC 821
3283 A few features of RFC 821 have proven to be problematic and should
3284 not be used in Internet mail. These are:
3288 This command, described in RFC 821, raises important security
3289 issues (described in RFC 1123). Its use is deprecated; SMTP
3290 systems SHOULD NOT use it unless the server can authenticate the
3295 RFC 821 utilized the concept of explicit source routing to get mail
3296 from one host to another via a series of relays. The requirement to
3297 utilize source routes in regular mail traffic was eliminated by the
3298 introduction of the domain name system "MX" record and the last
3299 significant justification for them was eliminated by the
3300 introduction, in RFC 1123, of a clear requirement that addresses
3301 following an "@" must all be fully-qualified domain names.
3302 Consequently, the only remaining justifications for the use of source
3303 routes are support for very old SMTP clients or MUAs and in mail system
3304 debugging. They can, however, still be useful in the latter
3305 circumstance and for routing mail around serious, but temporary,
3306 problems such as problems with the relevant DNS records.
3308 SMTP servers MUST continue to accept source route syntax as specified
3309 in the main body of this document and in RFC 1123. They MAY, if
3310 necessary, ignore the routes and utilize only the target domain in
3311 the address. If they do utilize the source route, the message MUST
3312 be sent to the first domain shown in the address. In particular, a
3313 server MUST NOT guess at shortcuts within the source route.
3315 Clients SHOULD NOT utilize explicit source routing except under
3316 unusual circumstances, such as debugging or potentially relaying
3317 around firewall or mail system configuration errors.
3321 As discussed in sections ##3.1 and ##4.1.1, EHLO is strongly
3322 preferred to HELO when the server will accept the former. Servers
3323 must continue to accept HELO in order to support older clients.
3328 RFC 821 provided for specifying an Internet address as a decimal
3329 integer host number prefixed by a pound sign, "#". In practice, that
3330 form has been obsolete since the introduction of TCP/IP. It is
3331 deprecated and MUST NOT be used.
3335 When dates are inserted into messages by SMTP clients or servers
3336 (e.g., in trace fields), four-digit years MUST BE used. Two-digit
3337 years are deprecated; three-digit years were never permitted in the
3338 Internet mail system.
3340 (6) Sending versus mailing
3342 In addition to specifying a mechanism for delivering messages to
3343 user's mailboxes, RFC 821 provided additional, optional, commands to
3344 deliver messages directly to the user's terminal screen.
3345 These commands (SEND, SAML, SOML) were rarely implemented, and
3346 changes in workstation technology and the introduction of other
3347 protocols may have rendered them obsolete even where they are
3350 Clients SHOULD NOT provide SEND, SAML, or SOML as services. Servers
3351 MAY implement them. If they are implemented by servers, the
3352 implementation model specified in RFC 821 MUST be used and the
3353 command names MUST be published in the response to the EHLO command.
3356 APPENDIX X: Change summary and Loose ends (temporary)
3360 X.1.1 Substantive changes between draft-ietf-drums-smtpupd-00.txt and
3361 draft-ietf-drums-smtpupd-01.txt
3363 (i) Slightly clarified the discussions of rejection and failure of
3364 VRFY requests and the associated response codes.
3366 (ii) Slightly clarified the discussion of deferred address
3369 (iii) Removed the IPCE terminology and modified the text in section
3370 ##4.1.1.2 to explicitly introduce the "mail gateway" terminology and
3371 to begin to distinguish a mail gateway from a conventional relay.
3372 **Please Review This Text**.
3374 (iv) Explicitly noted that SMTP clients for things like POP and IMAP
3375 may send everything to a single relay for further processing, rather
3376 than resolving final domain names.
3378 (v) Tightened the RSET discussion.
3380 (vi) Deprecation of 251 only for RCPT (still ok for VRFY)
3384 X.1.2. Substantive changes between draft-ietf-drums-smtpupd-01.txt
3385 and draft-ietf-drums-smtpupd-02.txt.
3387 Incorporated additional RFC 1123 material; reorganized several
3388 sections for clarity. Added definitions and other previous "loose
3394 (i) Material in RFC1123, section 5.2.6, not yet fully incorporated.
3396 (ii) Are 5.3.3 and 5.3.4 of RFC1123 adequately incorporated?
3398 (iii) What needs to be done about RFC1123 5.3.6 and 5.3.7 and where
3401 (iv) The 822 BNF -> ABNF transition is not yet complete, and most of
3402 what has been done needs checking.