INTERNET-DRAFT John Klensin, Editor Expires in six months MCI November 26, 1996 Simple Mail Transfer Protocol draft-ietf-drums-smtpupd-03.txt Status of this Memo This document is an Internet-Draft. Internet-Drafts are working documents of the Internet Engineering Task Force (IETF), its areas, and its working groups. Note that other groups may also distribute working documents as Internet-Drafts. Internet-Drafts are draft documents valid for a maximum of six months. Internet-Drafts may be updated, replaced, or obsoleted by other documents at any time. It is not appropriate to use Internet-Drafts as reference material or to cite them other than as a "working draft" or "work in progress". To learn the current status of any Internet-Draft, please check the 1id-abstracts.txt listing contained in the Internet-Drafts Shadow Directories on ds.internic.net (US East Coast), nic.nordu.net (Europe), ftp.isi.edu (US West Coast), or munnari.oz.au (Pacific Rim). If consensus is reached on this document, it will be forwarded to the IESG with the recommendation that it be processed as a Proposed Standard for mail transport. [[Sections marked with doubled brackets (e.g., "<<") are explicit placeholders or known major loose ends. The marking ## is a note in the draft to recheck a section number and should be ignored.]] TABLE OF CONTENTS 0. ABSTRACT 1. INTRODUCTION 2. THE SMTP MODEL 2.1 Basic structure 2.2 The extension model 2.3 Other terminology 2.4 Syntax Principles 3. THE SMTP PROCEDURES: AN OVERVIEW 3.1 Session initiation 3.2 Client initiation 3.3 Mail transactions 3.4 Forwarding for Address Correction or Updating 3.5 Commands for Debugging 3.6 Domains 3.7 Relaying 3.8 Terminating sessions and connections 4. THE SMTP SPECIFICATIONS 4.1. SMTP Commands 4.1.1. Command Semantics and Syntax 4.1.2. Lower-level Syntax 4.1.3 Order of commands 4.1.4 Private-use commands 4.2. SMTP Replies 4.2.1. Reply Codes by Function Group 4.2.2. Reply Codes in Numeric Order 4.2.3. Reply code 502 4.2.4 Reply codes after DATA and the subsequent CRLF.CRLF. 4.3. Sequencing of Commands and Replies 4.4 Trace information 4.5. Details 4.5.1. Minimum Implementation 4.5.2. Transparency 4.5.3. Sizes and Timeouts 4.5.4 Queuing Strategies 5. Address resolution and mail handling 6. Problem detection and handling 6.1 Reliable delivery and replies by email 6.2 Loop detection 6.3 Compensating for irregularities 7. Security Considerations 8. References 9. Editor's addresses 10. Acknowledgements APPENDIX A: TCP APPENDIX B: Generating SMTP commands from RFC 822 headers APPENDIX E: Theory of Reply Codes APPENDIX F: Scenarios APPENDIX G: Other gateway issues. APPENDIX H: Glossary APPENDIX I: Deprecated features of RFC 821 APPENDIX X: Change summary and Loose ends (temporary) 0. Abstract This document is a self-contained specification of the basic protocol for the Internet electronic mail transport, consolodating and updating * the original SMTP specification of RFC 821 [RFC-821], * Domain name system requirements and implications for mail transport from RFC 1035 [RFC-DNS] and RFC 974 [RFC974], * the clarifications and applicability statements in RFC 1123 [RFC-1123], and * material drawn from the SMTP Extension mechanisms [SMTPEXT]. It is intended to replace RFC 821, RFC 974, and the mail transport materials of RFC 1123. However, RFC 821 specifies some features that are not in significant use in the Internet of the mid-1990s and, in appendices, some additional transport models. Those sections are omitted in this document in the interest of clarity and brevity; readers needing them should refer to RFC 821. It also includes some additional material from RFC 1123 that appeared to need amplification. These have been identified in multiple ways, mostly by tracking flaming on the header-people list [HEADER-PEOPLE] and problems of unusual readings or interpretations that have turned up as the SMTP extensions have been deployed. It is important to note that everything here is in response to some identified confusion or bad behavior, not just paranoia. Where this specification moves beyond consolodation and actually differs from earlier documents, it supersedes them technically as well as textually. Although SMTP was designed as a mail transport and delivery protocol, this specification also contains information that is important to its use as a "mail posting" protocol, as recommended for POP [RFC-POP2, RFC-POP3] and IMAP [RFC-IMAP4]. Except when the historical terminology is necessary for clarity, this document uses the current "client" and "server" terminology to identify the sending and receiving SMTP processes, respectively. A companion document discusses mail bodies and formats RFC 822, MIME, and their relationship - [MSGFMT]. 1. INTRODUCTION The objective of the Simple Mail Transfer Protocol (SMTP) is to transfer mail reliably and efficiently. SMTP is independent of the particular transmission subsystem and requires only a reliable ordered data stream channel. While this document specifically discusses transport over TCP, other transports are possible. Appendices to RFC 821 describe some of them. A Glossary provides the definitions of terms as used in this document. An important feature of SMTP is its capability to transport mail across transport service environments, usually referred to as "mail gatewaying". A transport service environment might consist of the mutually-TCP-accessible hosts on the public internet, a firewall-isolated private TCP/IP LAN, or a LAN or WAN environment utilizing an entirely different transport-level protocol. It is important to realize that transport systems are not one-to-one with usual definitions of "networks". A process can communicate directly with another process, and mail communicated, through any mutually known transport layer. Conversely, mail can be relayed (actually gatewayed) between hosts on different transport systems by a host on both transport systems. The Mail eXchanger mechanisms of the domain name system [RFC-DNS, RFC974] usually permit relaying and gatewaying to occur invisibly to the user. 2. THE SMTP MODEL 2.1 Basic structure The SMTP design is based on the following model of communication: as the result of a user mail request (or transfer from a mail user agent (see section ##2.3)), the SMTP client establishes a two-way transmission channel to an SMTP server. Fully-capable client SMTPs determine the host address supporting the server SMTP function by resolving the domain name in the user request to it into either an intermediate mail exchanger host or a final target host. In other cases, common with clients associated with implementations of the POP [RFC-POP2, RFC-POP3] or IMAP [RFC-IMAP4] protocols, or when the client is inside an isolated transport service enviroment, the SMTP client may send all of its traffic to a single SMTP server which, in turn, relays the mail to final (or other intermediate) destinations. Those destinations in turn support all of the queuing, retrying, and alternate address functions discussed in this specification. The SMTP server may be either the ultimate destination or an intermediate (i.e., may assume the role of an SMTP client after receiving the message). SMTP commands are generated by the SMTP client and sent to the SMTP server. SMTP replies are sent from the SMTP server to the SMTP client in response to the commands. Once the transmission channel is established and initial handshaking completed, the SMTP-client normally initiates a mail transaction. Such a transaction consists of a series of commands to specify the originator and destination of the mail and transmission of the message body (including any headers or other structure) itself. When the same message is sent to multiple recipients the SMTP encourages the transmission of only one copy of the data for all the recipients at the same destination (or intermediate relay) host. The server responds to each command with a reply; replies may indicate that the command was accepted, that additional commands are expected, or that a temporary or permanent error condition exists. Commands that specify the sender or recipients may include server-permitted SMTP service extension requests as discussed in section ##2.2. The dialog is purposely lock-step, one-at-a-time although this can be modified by mutually-agreed extension requests. Once a given mail message has been transmitted, the client may either request that the connection be shut down or may initiate other mail transactions. ------------------------------------------------------------- +----------+ +----------+ +------+ | | | | | User |<-->| | SMTP | | +------+ | Sender- |Commands/Replies| Receiver-| +------+ | SMTP |<-------------->| SMTP | +------+ | File |<-->| | and Mail | |<-->| File | |System| | | | | |System| +------+ +----------+ +----------+ +------+ SMTP client SMTP server Model for SMTP Use Figure 1 ------------------------------------------------------------- Less commonly, the SMTP protocol and connection may be used by the client to request ancillary services of the server such as verification of addresses or exhibiting the contents of mailing lists. As suggested above, the SMTP provides mechanisms for the transmission of mail. This transmission occurs directly from the sending user's host to the receiving user's host when the two hosts are connected to the same transport service. When they are not connected to the same transport service, transmission occurs via one or more relay SMTP-servers. An intermediate host that will act as either an SMTP relay or as a gateway into some other transmission environment may also be selected through the use of the domain name service (DNS) Mail eXchanger mechanism. To be able to provide the relay capability the server SMTP is supplied with the name of the ultimate destination host as well as the destination mailbox name. Usually, intermediate hosts are determined via the DNS MX record, not by explicit "source" routing (see Appendix I). 2.2 The Extension Model 2.2.1 Background In an effort that started in 1990, approximately a decade after RFC 821 was completed, the protocol was modified with a "service extensions" model that permits the client and server to agree to utilize shared functionality that goes beyond the original basic SMTP requirements. Contemporary SMTP implementations MUST support the basic extension mechanisms (see below for details), i.e., servers MUST support the EHLO command even if they do not implement any specific extensions and clients MUST preferentially utilize EHLO rather than HELO. However, for compatibility with older implementations (which are expected to persist for some years), SMTP clients and servers MUST support the original HELO mechanisms as a fallback. Although SMTP is widely and robustly deployed, some parts of the Internet community might wish to extend the SMTP service. The SMTP extension mechanism defines a means whereby an extended SMTP client and server may recognize each other as such and the server can inform the client as to the service extensions that it supports. It must be emphasized that any extension to the SMTP service should not be considered lightly. SMTP's strength comes primarily from its simplicity. Experience with many protocols has shown that: protocols with few options tend towards ubiquity, whilst protocols with many options tend towards obscurity. This means that each and every extension, regardless of its benefits, must be carefully scrutinized with respect to its implementation, deployment, and interoperability costs. In many cases, the cost of extending the SMTP service will likely outweigh the benefit. Given this environment, the extension framework consists of: (1) The SMTP command EHLO, superseding the earlier HELO, (2) a registry of SMTP service extensions, and (3) additional parameters to the SMTP MAIL FROM and RCPT TO commands. 2.2.2 Definition and Registration of Extensions The IANA maintains a registry of SMTP service extensions. Associated with each such extension is a corresponding EHLO keyword value. Each service extension registered with the IANA must be defined in an RFC. Such RFCs must either be on the standards-track or must define an IESG-approved experimental protocol. The definition must include: (1) the textual name of the SMTP service extension; (2) the EHLO keyword value associated with the extension; (3) the syntax and possible values of parameters associated with the EHLO keyword value; (4) any additional SMTP verbs associated with the extension (additional verbs will usually be, but are not required to be, the same as the EHLO keyword value); (5) any new parameters the extension associates with the MAIL FROM or RCPT TO verbs; (6) how support for the extension affects the behavior of a server and client SMTP; and, (7) the increment by which the extension is increasing the maximum length of the commands MAIL FROM, RCPT TO, or both, over that specified in RFC 821. In addition, any EHLO keyword value that starts with an upper or lower case "X" refers to a local SMTP service extension, which is used through bilateral, rather than standardized, agreement. Keywords beginning with "X" may not be used in a registered service extension. Any keyword values presented in the EHLO response that do not begin with "X" must correspond to a standard, standards-track, or IESG-approved experimental SMTP service extension registered with IANA. A conforming server must not offer non-"X"-prefixed keyword values that are not described in a registered extension. Additional verbs are bound by the same rules as EHLO keywords; specifically, verbs begining with "X" are local extensions that may not be registered or standardized and verbs not beginning with "X" must always be registered. 2.3 Terminology A glossary of terms appears at the end of this document. However, the following terms and concepts are used in special ways here, or represent differences in terminology between RFC 821 and this document, and should be understood before reading further. 2.3.1 Mail objects SMTP relays a mail object containing an envelope and a content. (1) The SMTP envelope is straightforward, and is sent as a series of SMTP protocol units (described in section ##3): it consists of an originator address (to which error reports should be directed); a delivery mode (e.g., deliver to recipient mailboxes); and, one or more recipient addresses. (2) The SMTP content is sent in the SMTP DATA protocol unit and has two parts: the headers and the body. The headers form a collection of field/value pairs structured according to RFC 822 [RFC822], whilst the body, if structured, is defined according to MIME [3]. The content is textual in nature, expressed using the US ASCII repertoire (ANSI X3.4-1986). Although extensions (such as MIME) may relax this restriction for the content body, the content headers are always encoded using the US ASCII repertoire. The algorithm defined in [4] is used to represent header values outside the US ASCII repertoire, whilst still encoding them using the US ASCII repertoire. 2.3.2. Sender and receivers In RFC 821, the two hosts participating in an SMTP transaction were described as the "SMTP-sender" and "SMTP-receiver". This document has been changed to reflect current industry terminology and hence refers to them as the "SMTP client" (or sometimes just "the client") and "SMTP server" (or just "the server") respectively. Since a given host may act both as server and client in a relay situation, "receiver" and "sender" terminology is still used where needed for clarity. 2.3.3. Mail agents Other mail system terminology became common after RFC 821 was published and, where convenient, is used in this specification. In particular, SMTP servers and clients provide a mail transport service and therefore act as Mail Transfer Agents (MTAs). Mail User Agents (MUAs or UAs) are normally thought of as the sources and targets of mail. At the source, an MUA might collect mail to be transmitted from a user and hand it off to an MTA; the final ("delivery") MTA would be thought of as handing the mail off to an MUA (or at least transferring responsibility to it). However, while these terms are used with at least the appearance of great precision in other environments, the implied boundaries between MUAs and MTAs often do not accurately match common, and conforming, practices with Internet mail. Hence, the reader should be cautious about inferring the strong relationships and responsibilities that might be implied if these terms were used elsewhere. 2.3.4 host For the purposes of this specification, a computer system attached to the Internet (or, in some cases, to a private TCP/IP network) and supporting the SMTP protocol. Hosts are known by names (see "domain"); identifying them by address is discouraged. 2.3.5 domain The name of a host (often referred to as a "fully-qualified domain name" or "FQDN") or some entry in the domain name hierarchy, usually referred to as a "subdomain", that may contain many hosts. A domain, or domain name, may also refer to an alias ("CNAME") or may provide a reference to Mail eXchanger records to be used to deliver mail. See [RFC-DNS] and section ##5. Some published material about the Internet (and about Internet mail in particular) refers to a "host in a domain" as if the host name were an unqualified name with a domain name appended to it. This convention has caused considerable confusion and some protocol violations: the domain name, as described in this document and in [RFC-DNS], is the entire, fully-qualified name, and an apparent host name that is not in FQDN form is no more than a local alias. 2.3.6 buffer and state table The SMTP protocol is described in terms of an abstract machine that accumulates some information as the various commands are issued as well as remembering, to the extent necessary, the sequence of commands and the commands anticipated next. Using the terminology of one possible implementation model, the storage for information accumulation is referred to in this document as the "buffer" and the history of commands and anticipated actions is referred to as the "state table". The operations of "clearing the buffer" or "resetting the state table" involve restoring that accumulated information to their status and content before the relevant commands were issued. 2.4 Syntax Principles 2.4.1 General syntax and transaction model The mail commands and replies have a rigid syntax. Replies also have a numeric code. In the following, examples appear which use actual commands and replies. The complete lists of commands and replies appears in Section ##4 on specifications. Commands and replies are not case sensitive. That is, a command or reply word MAY be upper case, lower case, or any mixture of upper and lower case. Note that this is not true of mailbox user names. For some hosts the user name is case sensitive (this practice impedes interoperability and is discouraged), and SMTP implementations MUST take care to preserve the case of user names as they appear in mailbox arguments. Domain names are not case sensitive. Commands and replies are composed of characters from the ASCII character set [1]. When the transport service provides an 8-bit byte (octet) transmission channel, each 7-bit character is transmitted right justified in an octet with the high order bit cleared to zero. More specifically, the unextended SMTP service provides seven bit transport only. SMTP clients MUST NOT transmit messages with information in the high-order bit of octets. If such messages are transmitted in violation of this rule, receiving SMTP servers MAY clear the high-order bit or reject the message as invalid. Eight-bit transmission MAY be requested of the server by the client using extended SMTP facilities, notably the "8BITMIME" extension. 8BITMIME SHOULD be supported by SMTP servers. However, it MUST not be construed as authorization to transmit unrestricted 8 bit material; for material with the high bit on that is not in MIME format with an appropriate content-transfer encoding, "8BITMIME" MUST NOT be requested by senders snd server MAY respond as discussed above. The metalinguistic notation used in this document corresponds to the "Augmented BNF" used in other Internet mail system documents. The reader who is not familiar with that syntax should consult [ABNF]. 2.4.2 Command and reply syntax The commands consist of a command code followed by an argument field. Command codes are four alphabetic characters. Upper and lower case alphabetic characters are to be treated identically. Thus, any of the following may represent the mail command: MAIL Mail mail MaIl mAIl This also applies to any symbols representing parameter values, such as "TO" or "to" for the forward-path. Command codes and the argument fields are separated by one or more spaces. However, within the reverse-path and forward-path arguments case is important. In particular, in some hosts the user "smith" is different from the user "Smith". The argument field consists of a variable length character string ending with the character sequence <CRLF>. The receiver is to take no action until this sequence is received. The syntax for each command is shown with the discussion of that command. Common elements and parameters are shown in section ##4.1.2. 3. THE SMTP PROCEDURES: AN OVERVIEW This section presents the procedures used in SMTP in several parts. After a review of session initiation by the server and client, there is the basic mail procedure defined as a mail transaction. Following this are descriptions of forwarding mail, verifying mailbox names and expanding mailing lists, and the opening and closing exchanges. At the end of this section are comments on relaying, a note on mail domains, and a discussion of changing roles. Throughout this section are examples of partial command and reply sequences, several complete scenarios are presented in Appendix F. 3.1 Session initiation An SMTP session is initiated by the client opening a connection to the server and the server responding with an opening message. SMTP server implementations SHOULD include identification of their software and version information in the connection greeting reply after the 220 code. This practice permits much more efficient isolation and repair of any problems. While some systems also identify their contact point for mail problems, this is not a substitute for maintaining the required Postmaster address (see [RFC822]). Implementations MAY make provision for SMTP servers to be configured to disable the software and version announcement where it causes security concerns. 3.2 Client initiation: EHLO The client then sends the EHLO command to the server, indicating its identity. In addition to opening the session, use of EHLO indicates that the client is able to process service extensions and requests that the server provide a list of the extensions it supports. Older SMTP systems, unable to support service extensions, MAY use HELO instead of EHLO but EHLO SHOULD be used by all current clients and accepted by all current systems. In the EHLO, or the older HELO, command the host sending the command identifies itself; the command may be interpreted as saying "Hello, I am <domain>" (and, in the case of EHLO, "and I support service extension requests"). ------------------------------------------------------------- | | Example of Connection Opening | | R: 220 BBN-UNIX.ARPA Simple Mail Transfer Service Ready | S: HELO USC-ISIF.ARPA | R: 250 BBN-UNIX.ARPA | | Example 5 | ------------------------------------------------------------- ------------------------------------------------------------- | | Example of Connection Closing | | S: QUIT | R: 221 BBN-UNIX.ARPA Service closing transmission channel | | Example 6 | ------------------------------------------------------------- 3.3. Mail Transactions There are three steps to SMTP mail transactions. The transaction is started with a MAIL command which gives the sender identification. A series of one or more RCPT commands follows giving the receiver information. Then a DATA command gives the mail data. And finally, the end of mail data indicator confirms the transaction. The first step in the procedure is the MAIL command. The <reverse-path> contains the source mailbox. MAIL <SP> FROM:<reverse-path> [<SP> <mail-parameters>] <CRLF> This command tells the SMTP-receiver that a new mail transaction is starting and to reset all its state tables and buffers, including any recipients or mail data. It gives the reverse-path which can be used to report errors (see section ##4.2 for a discussion of error reporting). If accepted, the SMTP server returns a 250 OK reply. The <reverse-path> can contain more than just a mailbox. The <reverse-path> is a reverse source routing list of hosts and source mailbox. The first host in the <reverse-path> should be the host sending this command. The optional <mail-parameters> are associated with negotiated SMTP service extensions (see section ##2.2). The second step in the procedure is the RCPT command. RCPT <SP> TO:<forward-path> [<SP> <rcpt-parameters>] <CRLF> This command gives a forward-path (normally a mailbox and domain) identifying one recipient. If accepted, the SMTP server returns a 250 OK reply, and stores the forward-path. If the recipient is unknown the SMTP server returns a 550 Failure reply (other circumstances and reply codes are possible). This second step of the procedure can be repeated any number of times. The <forward-path> can contain more than just a mailbox. The <forward-path> may be a source routing list of hosts and the destination mailbox. However, in general, the <forward-path> should contain only a mailbox and domain name, relying on the domain name system to supply routing information if required. Servers MUST be prepared to encounter a list of source routes in the forward path, but MAY ignore the routes or decline to support the relaying they imply. Similarly, servers MAY decline to accept mail that is destined for other hosts or systems. Of course, such a restrictions would make a server useless as a relay for clients that do not support full SMTP functionality, but such clients MUST NOT assume that any SMTP server on the Internet can be used as their mail processing site. Clients SHOULD NOT utilize explicit source routing except as discussed in Appendix I. The optional <mail-parameters> are associated with negotiated SMTP service extensions (see section ##2.2). The third step in the procedure is the DATA command. DATA <CRLF> If accepted, the SMTP server returns a 354 Intermediate reply and considers all succeeding lines to be the message text. When the end of text is received and stored the SMTP-receiver sends a 250 OK reply. Since the mail data is sent on the transmission channel, the end of the mail data must be indicated so that the command and reply dialog can be resumed. SMTP indicates the end of the mail data by sending a line containing only "." (period or full stop). A transparency procedure is used to prevent this from interfering with the user's text (see Section ##4.5.2). The end of mail data indicator also confirms the mail transaction and tells the SMTP server to now process the stored recipients and mail data. If accepted, the SMTP server returns a 250 OK reply. The DATA command should fail only if the mail transaction was incomplete (for example, no recipients), or if resources are not available. However, some servers in practice do not perform recipient verification until after the message text is received. These servers SHOULD treat a failure for one or more recipients as a "subsequent failure" and return a mail message as discussed in section ##6. Using a "recipient not found" or equivalent reply code after the data are accepted makes it difficult or impossible for the client to determine which recipients failed. Please note that, when RFC 822 format is being used, the mail data includes the memo header items such as Date, Subject, To, Cc, From [RFC822]. Server SMTP systems SHOULD NOT reject messages based on perceived defects in the RFC 822 or MIME [MIME] message header or message body. In particular, they MUST NOT reject messages on the basis of trying to match numbers of Resent- fields. In particular, messages MUST NOT be rejected because Resent-to appears without Resent-from, Resent-date, or both. The above procedure is an example of a mail transaction. These commands must be used only in the order discussed above. Example 1 (below) illustrates the use of these commands in a mail transaction. ------------------------------------------------------------- | | Example of the SMTP Procedure | | This SMTP example shows mail sent by Smith at host Alpha.ARPA, | to Jones, Green, and Brown at host Beta.ARPA. Here we assume | that host Alpha contacts host Beta directly. | | S: MAIL FROM:<Smith@Alpha.ARPA> | R: 250 OK | | S: RCPT TO:<Jones@Beta.ARPA> | R: 250 OK | | S: RCPT TO:<Green@Beta.ARPA> | R: 550 No such user here | | S: RCPT TO:<Brown@Beta.ARPA> | R: 250 OK | | S: DATA | R: 354 Start mail input; end with <CRLF>.<CRLF> | S: Blah blah blah... | S: ...etc. etc. etc. | S: <CRLF>.<CRLF> | R: 250 OK | | The mail has now been accepted for Jones and Brown. Green did | not have a mailbox at domain Beta.ARPA. | | Example 1 | ------------------------------------------------------------- 3.4. Forwarding for Address Correction or Updating The "forwarding" mechanisms described in section 3.2 of RFC 821, and especially the 251 reply code from RCPT that indicates a corrected destination, are no longer in active use. Forwarding support is most often required to consolodate and simplify addresses within, or relative to, some enterprise. In most of those cases, information hiding (and sometimes security) considerations argue against exposure of the "final" address through the SMTP protocol as a consequence of the forwarding activity and, in some cases, that final address may not even be reachable by the sender. Silent forwarding of messages (without server notification to the sender) is common in the contemporary Internet. If the forwarding and address correction mechanisms described in RFC 821 are used, the addresses given should be stable enough that it would be reasonable for the client to update local records with them. 3.5. Commands for Debugging 3.5.1 Overview SMTP provides, as additional features, commands to verify a user name or expand a mailing list. This is done with the VRFY and EXPN commands, which have character string arguments. For the VRFY command, the string is a user name (see below) and the response may include the full name of the user and must include the mailbox of the user, e.g., it MUST BE in either User Name <mailbox@domain> or mailbox@domain form. Paths (explicit source routes) MUST NOT be returned by VRFY or EXPN. When a name that is the argument to VRFY could identify more than one mailbox, the server MAY either note the ambiguity or identify the alternatives. In other words, either of the following are legitimate response to VRFY: 553 User ambiguous or 553- Ambiguous; Possibilities are 553-Joe Smith <jsmith@somedomain> 553-Harry Smith <hsmith@somedomain> 553 Melvin Smith <dweep@somedomain> Under normal circumstances a client receiving a 553 reply would be expected to expose the result to the user. Use of exactly the forms given, and the "user ambiguous" or "ambiguous" keywords, will facilitate automated translation into other languages as needed. For the EXPN command, the string identifies a mailing list, and the multiline response may include the full name of the users and must give the mailboxes on the mailing list. "User name" is a fuzzy term and used purposely. An implementation of the VRFY or EXPN commands MUST include at least recognition of local mailboxes as "user names". If a host chooses to recognize other strings as "user names" that is allowed. In some hosts the distinction between a mailing list and an alias for a single mailbox is a bit fuzzy, since a common data structure may hold both types of entries, and it is possible to have mailing lists of one mailbox. If a request is made to verify a mailing list a positive response can be given if on receipt of a message so addressed it will be delivered to everyone on the list, otherwise an error should be reported (e.g., "550 That is a mailing list, not a user"). If a request is made to expand a user name a positive response can be formed by returning a list containing one name, or an error can be reported (e.g., "550 That is a user name, not a mailing list"). In the case of a multiline reply (normal for EXPN) exactly one mailbox is to be specified on each line of the reply. The case of an ambiguous request is discussed above. The case of verifying a user name is straightforward as shown in example 3. ----------------------------------------------------------------- | | Example of Verifying a User Name | | Either | | S: VRFY Smith | R: 250 Fred Smith <Smith@USC-ISIF.ARPA> | | Or | | S: VRFY Smith | R: 251 User not local; will forward to <Smith@USC-ISIQ.ARPA> | | Or | | S: VRFY Jones | R: 550 String does not match anything. | | Or | | S: VRFY Jones | R: 551 User not local; please try <Jones@USC-ISIQ.ARPA> | | Or | | S: VRFY Gourzenkyinplatz | R: 553 User ambiguous. | | Example 3 | ----------------------------------------------------------------- The case of expanding a mailbox list requires a multiline reply as shown in example 4. ------------------------------------------------------------- | | Example of Expanding a Mailing List | | Either | | S: EXPN Example-People | R: 250-Jon Postel <Postel@USC-ISIF.ARPA> | R: 250-Fred Fonebone <Fonebone@USC-ISIQ.ARPA> | R: 250-Sam Q. Smith <SQSmith@USC-ISIQ.ARPA> | R: 250-Quincy Smith <@USC-ISIF.ARPA:Q-Smith@ISI-VAXA.ARPA> | R: 250-<joe@foo-unix.ARPA> | R: 250 <xyz@bar-unix.ARPA> | | Or | | S: EXPN Executive-Washroom-List | R: 550 Access Denied to You. | | Example 4 | ------------------------------------------------------------- The character string arguments of the VRFY and EXPN commands cannot be further restricted due to the variety of implementations of the user name and mailbox list concepts. On some systems it may be appropriate for the argument of the EXPN command to be a file name for a file containing a mailing list, but again there is a variety of file naming conventions in the Internet. 3.5.2 VRFY normal response. When normal (2yz or 551) responses are returned from a VRFY or EXPN request, the reply should normally include the mailbox name, e.g., "<foo@bar>" (where "bar" is a fully qualified domain name) must appear in the syntax. In exceptional circumstances, free-form text MAY be returned. In order to facilitate parsing by both computers and people, addresses SHOULD appear in pointed brackets. EXPN and VRFY MUST return only valid domain addresses that are usable in SMTP RCPT commands. Consequently, if an address implies delivery to a program or other system, the mailbox name used to reach that target should be given. Server implementations MUST support VRFY and SHOULD support EXPN. For security reasons, implementations MAY provide local installations a way to disable either or both of these commands through configuration options or the equivalent. When these commands are supported, they are not required to work across relays when relaying is supported. Since they were both optional in RFC 821, they MUST, if supported, be listed in the response to EHLO if service extensions are supported. 3.5.3 Meaning of VRFY or EXPN success response. A server MUST NOT return a 220 code in response to a VRFY or EXPN command unless it has actually verified the address. In particular, a server MUST NOT return 220 if all it has done is to verify that the syntax given is valid. In that case 502 (Command not implemented) or 500 (Syntax error, command unrecognized) SHOULD be returned (note that implementation of VRFY is required by RFC 1123 and EXPN is strongly recommended; this specification does not change that requirement and, hence, except as provided in section ##3.5.5, implementations that return 500 or 502 for VRFY are not in compliance with these specifications). Especially when a server is acting as a mail exchanger for another, there may be circumstances where an address appears to be correct but cannot reasonably be verified in real time. In that situation, reply code 252 SHOULD BE returned. These cases parallel the discussion of RCPT verification discussed in section ##2.1 although implementations generally SHOULD be more aggressive about address verification in the case of VRFY than in the case of RCPT even if a little more time is required to do so. 3.5.4. Semantics and applications of EXPN. While EXPN is often very useful in debugging and understanding problems with mailing lists and multiple-target-address aliases, some systems have attempted to use source expansion of mailing lists as a means of eliminating duplicates. The propagation of aliasing systems with mail on the Internet--both for hosts (typically with MX and CNAME DNS records) and for mailboxes (various types of local host aliases) has made it nearly impossible for these strategies to work, and mail systems SHOULD NOT attempt them. 3.5.5 VRFY, EXPN, and security. As discussed above, individual sites may want to disable one or both of VRFY or EXPN for security reasons. As a corollary to the above, implementations that permit this MUST NOT appear to have verified addresses that are not, in fact, verified. If a site disables these commands for security reasons, the SMTP server SHOULD return a 252 response, rather than a code that could be confused with successful or unsuccessful verification. Returning a 250 reply code with the address listed in the VRFY command after having checked it for syntax only violates this rule. Of course, an implementation that "supports" VRFY by always returning 550 whether or not the address is valid is equally not in conformance. Within the last four years, the contents of mailing lists have become popular as an address information source for so-called "spammers" and their popularity has increased as the administrators of the lists have devised and installed protections against inappropriate uses of the lists themselves. Implementations SHOULD still provide support for EXPN, but sites should carefully evaluate the tradeoffs between the advantages of having EXPN available for debugging purposes and the disadvantages of exposing information that may be used in ways that list members may consider inappropriate. 3.6. Domains Domains have become a key concept in the Internet mail system. The use of domains changes the address space from a flat global space of simple character string host names to a hierarchically structured rooted tree of global addresses. The host name is replaced by a domain designator which is a sequence of domain element strings separated by periods with the understanding that the domain elements are ordered from the most specific to the most general. For example, "ISIF.ISI.EDU", "Fred.Cambridge.UK", and "PC7.LCS.MIT.EDU" might be domain identifiers. Whenever domain names are used in SMTP, only resolvable, fully-qualified, domain names (FQDNs) are permitted. In other words, names that can be resolved to MX RRs or A RRs (as discussed in section ##5.??.??) are permitted, as are CNAME RRs whose targets can be resolved, in turn, to MX or A RRs. Local nicknames or unqualified names MUST NOT be used. There is one exception to this rule: the domain name given in the EHLO (or HELO) command MUST BE either a primary host name (a domain name that resolves to an A RR) or, if the host has no name, a domain literal in dotted-decimal notation. 3.7. RELAYING The forward-path may be a source route of the form "@ONE,@TWO:JOE@THREE", where ONE, TWO, and THREE MUST BE fully-qualified domain names. This form is used to emphasize the distinction between an address and a route. The mailbox is an absolute address, and the route is information about how to get there. The two concepts should not be confused. In general, the availability of Mail eXchanger records in the domain name system [RFC-DNS] makes the use of explicit source routes in the Internet mail system unnecessary. Many historical problems with their interpretation have made their use undesirable. SMTP clients SHOULD NOT generate explicit source routes except under unusual circumstances. SMTP servers MAY decline to act as mail relays or to accept addresses that specify source routes. They are also permitted to ignore the route information and simply send to the final destination as specified in the route and the DNS. However, there has been a practice, albeit invalid, of using names that do not appear in the DNS as destination names, with the senders counting on the intermediate hosts specified in source routing to resolve any problems. If source routes are stripped, this practice will cause failures -- one of several reasons why SMTP clients MUST NOT generate invalid source routes or depend on serial resolution of names. If source routes are not used, the process described in RFC 821 for constructing a reverse-path from the forward-path is not applicable and the reverse-path at the time of delivery will simply be the address that appeared in the MAIL command. If source routes are used, RFC 821 should be consulted for the mechanisms for constructing and updating the forward- and reverse-paths. Using source routing the SMTP server receives mail to be relayed to another SMTP server. The SMTP server may accept or reject the task of relaying the mail in the same way it accepts or rejects mail for a local user. The SMTP server transforms the command arguments by moving its own identifier (its domain name or that of any domain for which it is acting as a mail exchanger), if it appears, from the forward-path to the beginning of the reverse-path. The SMTP server then becomes an SMTP client, establishes a transmission channel to the next SMTP server in the forward-path, and sends it the mail. Notice that the forward-path and reverse-path appear in the SMTP commands and replies, but not necessarily in the message. That is, there is no need for these paths and especially this syntax to appear in the "To:" , "From:", "CC:", etc. fields of the message header. Conversely, SMTP servers MUST NOT derive final message delivery information from message header fields. If an SMTP server has accepted the task of relaying the mail and later finds that the forward-path is incorrect or that the mail cannot be delivered for some other reason, then it MUST construct an "undeliverable mail" notification message and send it to the originator of the undeliverable mail (as indicated by the reverse-path). Formats specified for non-delivery reports by other standards SHOULD be used if possible. This notification message must be from the SMTP server at the relay host or the host that first determines that delivery cannot be accomplished. Of course, SMTP servers should not send notification messages about problems with notification messages. One way to prevent loops in error reporting is to specify a null reverse-path in the MAIL command of a notification message. When such a message is transmitted the reverse-path SHOULD BE set to null. A MAIL command with a null reverse-path appears as follows: MAIL FROM:<> An undeliverable mail notification message is shown in example 7. This notification is in response to a message originated by JOE at HOSTW and sent via HOSTX to HOSTY with instructions to relay it on to HOSTZ. What we see in the example is the transaction between HOSTY and HOSTX, which is the first step in the return of the notification message. ------------------------------------------------------------- | | Example Undeliverable Mail Notification Message | | S: MAIL FROM:<> | R: 250 ok | S: RCPT TO:<@HOSTX.ARPA:JOE@HOSTW.ARPA> | R: 250 ok | S: DATA | R: 354 send the mail data, end with . | S: Date: 23 Oct 81 11:22:33 | S: From: SMTP@HOSTY.ARPA | S: To: JOE@HOSTW.ARPA | S: Subject: Mail System Problem | S: <<>>replace with NOTARY format <<>> | S: . | R: 250 ok | | Example 7 | ------------------------------------------------------------- 3.8. Terminating Sessions and Connections An SMTP connection is terminated by the client's sending a QUIT command. The server then responds with a positive reply code, after which it closes the connection. An SMTP server MUST NOT intentionally close the connection except: o After receiving a QUIT connand and responding with a 221 reply. o After detecting the need to shutdown the SMTP service and returning a 451 reply to any command. In particular, a server that closes connections in response to commands that are not understood is in violation of this specification. Instead, servers are expected to be tolerant of unknown commands, issuing a 500 reply and awaiting further instructions from the client. An SMTP server which is forcibly shut down via external means SHOULD attempt to send a line containing 451 response code to the SMTP client before exiting. The SMTP client will normally read the 451 response code after sending its next command. 4. THE SMTP SPECIFICATIONS 4.1. SMTP COMMANDS 4.1.1. COMMAND SEMANTICS AND SYNTAX The SMTP commands define the mail transfer or the mail system function requested by the user. SMTP commands are character strings terminated by <CRLF>. The command codes themselves are alphabetic characters terminated by <SP> if parameters follow and <CRLF> otherwise. The syntax of mailboxes must conform to receiver site conventions. The SMTP commands are discussed below. The SMTP replies are discussed in Section ##4.2. A mail transaction involves several data objects which are communicated as arguments to different commands. The reverse-path is the argument of the MAIL command, the forward-path is the argument of the RCPT command, and the mail data is the argument of the DATA command. These arguments or data objects must be transmitted and held pending the confirmation communicated by the end of mail data indication which finalizes the transaction. The model for this is that distinct buffers are provided to hold the types of data objects, that is, there is a reverse-path buffer, a forward-path buffer, and a mail data buffer. Specific commands cause information to be appended to a specific buffer, or cause one or more buffers to be cleared. 4.1.1.1 Extended HELLO (EHLO) or HELLO (HELO) These commands are used to identify the SMTP client to the SMTP server. The argument field contains the host name of the SMTP client. The SMTP server identifies itself to the SMTP client in the connection greeting reply, and in the response to this command. A client SMTP SHOULD start an SMTP session by issuing the EHLO command. If the SMTP server supports the SMTP service extensions it will give a successful response, a failure response, or an error response. If the SMTP server does not support any SMTP service extensions it will generate an error response. Older client SMTP systems MAY, as discussed above, use HELO (as specified in RFC 821) instead of EHLO. These commands and an OK reply to one of them confirm that both the SMTP client and the SMTP server are in the initial state, that is, there is no transaction in progress and all state tables and buffers are cleared. If the server SMTP implements and is able to perform the EHLO command, it will return code 250. This indicates that both the server and client SMTP are in the initial state, that is, there is no transaction in progress and all state tables and buffers are cleared. Normally, this response will be a multiline reply. Each line of the response contains a keyword and, optionally, one or more parameters. The syntax for a positive response, using the ABNF notation of [RFC822], is: ehlo-ok-rsp ::= "250" domain [ SP greeting ] CR LF / ( "250-" domain [ SP greeting ] CR LF *( "250-" ehlo-line CR LF ) "250" SP ehlo-line CR LF ) ; the usual HELO chit-chat greeting ::= 1*<any character other than CR or LF> ehlo-line ::= ehlo-keyword *( SP ehlo-param ) ehlo-keyword ::= (ALPHA / DIGIT) *(ALPHA / DIGIT / "-") ; syntax and values depend on ehlo-keyword ehlo-param ::= 1*<any CHAR excluding SP and all control characters (US ASCII 0-31 inclusive)> ALPHA ::= <any one of the 52 alphabetic characters (A through Z in upper case, and, a through z in lower case)> DIGIT ::= <any one of the 10 numeric characters (0 through 9)> CR ::= <the carriage-return character (ASCII decimal code 13)> LF ::= <the line-feed character (ASCII decimal code 10)> SP ::= <the space character (ASCII decimal code 32)> Although EHLO keywords may be specified in upper, lower, or mixed case, they must always be recognized and processed in a case-insensitive manner. This is simply an extension of practices specified in RFC 821. 4.1.1.2 MAIL (MAIL) This command is used to initiate a mail transaction in which the mail data is delivered to one or more mailboxes. The argument field contains a reverse-path. The reverse-path consists of an optional list of hosts and the sender mailbox. When the list of hosts is present, it is a "reverse" source route and indicates that the mail was relayed through each host on the list (the first host in the list was the most recent relay). This list is used as a source route to return non-delivery notices to the sender. As each relay host adds itself to the beginning of the list, it must use its name as known in the transport environment to which it is relaying the mail rather than that of the transport environment from which the mail came (if they are different). In some types of error reporting messages (for example, undeliverable mail notifications) the reverse-path may be null (see Example 7). This command clears the reverse-path buffer, the forward-path buffer, and the mail data buffer; and inserts the reverse-path information from this command into the reverse-path buffer. If service extensions were negotiated, the MAIL command may also carry parameters associated with a particular service extension. Syntax: "MAIL FROM:" Reverse-path [ Mail-parameters ] or "MAIL FROM:<>" 4.1.1.3 RECIPIENT (RCPT) This command is used to identify an individual recipient of the mail data; multiple recipients are specified by multiple use of this command. The forward-path normally consists a required destination mailbox. Sending systems SHOULD not generate the optimal list of hosts known as a source route. Recieving systems MUST recognize source route syntax but SHOULD strip off the source route specification and utilize the domain name associated with the mailbox as if the source route had not appeared. Similarly, relay host SHOULD strip or ignore source routes and names MUST NOT be copied into the reverse-path. When mail reaches its ultimate destination (the forward-path contains only a destination mailbox), the SMTP server inserts it into the destination mailbox in accordance with its host mail conventions. For example, mail received at relay host A with arguments FROM:<USERX@HOSTY.ARPA> TO:<@HOSTA.ARPA,@HOSTB.ARPA:USERC@HOSTD.ARPA> will be relayed on to host B with arguments FROM:<USERX@HOSTY.ARPA> TO:<USERC@HOSTD.ARPA>. If service extensions were negotiated, the MAIL command may also carry parameters associated with a particular service extension. Syntax: "RCPT TO:" Forward-path [ Rcpt-parameters ] 4.1.1.4 DATA (DATA) The receiver treats the lines (strings ending in CRLF sequences) following the command as mail data from the sender. This command causes the mail data from this command to be appended to the mail data buffer. The mail data may contain any of the 128 ASCII character codes, although experience has indicated that use of control characters other then SP, HT, CR, and LF may cause problems and should be avoided when possible. SMTP is defined in terms of sending messages consisting of lines of text. Lines are strictly defined as ending in ASCII CR LF sequences. Systems that use other line delimiting mechanisms internally MUST convert to CR LF sequences before transmitting mail with unextended SMTP or with any SMTP service extension on the standards track as of the time of this writing. The mail data is terminated by a line containing only a period, that is the character sequence "<CRLF>.<CRLF>" (see Section ##4.6.2 on Transparency). This is the end of mail data indication. The custom of accepting lines ending only in LF, as a concession to non-conforming behavior on the part of some UNIX systems, has proven to cause more interoperability problems than it solves and SMTP server systems MUST NOT do this, even in the name of improved robustness. In particular, the sequence "LF.LF" (bare line feeds, without carriage returns) MUST NOT be treated as equivalent to CRLF.CRLF as the end of mail data indication. Receipt of the end of mail data indication requires that the server process the stored mail transaction information. This processing consumes the information in the reverse-path buffer, the forward-path buffer, and the mail data buffer, and on the completion of this command these buffers are cleared. If the processing is successful the receiver must send an OK reply. If the processing fails completely the receiver must send a failure reply. When the SMTP server accepts a message either for relaying or for final delivery it inserts a trace record (also referred to interchangabily as a "time stamp line" or "Received" line) at the top of the mail data. This trace record indicates the identity of the host that sent the message, and the identity of the host that received the message (and that is inserting this time stamp), and the date and time the message was received. Relayed messages will have multiple time stamp lines. Details for formation of these lines, including their syntax, is specified in section ##4.4. 4.1.1.5 RESET (RSET) This command specifies that the current mail transaction is to be aborted. Any stored sender, recipients, and mail data must be discarded, and all buffers and state tables cleared. The receiver must send an OK reply. A reset command may be issued by the client at any time. It is effectively equivalent to a NOOP if issued immediately after EHLO or HELO, or before either of those commands have been issued. In other situations, it restores the state to that immediately after the most recent EHLO or HELO. An SMTP server MUST NOT close the connection as the result of receiving a RSET; that action is reserved for QUIT (see section ##4.1.1.10, below). 4.1.1.6 VERIFY (VRFY) This command asks the receiver to confirm that the argument identifies a user. If it is a user name, the full name of the user (if known) and the fully specified mailbox are returned. This command has no effect on any of the reverse-path buffer, the forward-path buffer, or the mail data buffer. Syntax: "VRFY" SP String 4.1.1.7 EXPAND (EXPN) This command asks the receiver to confirm that the argument identifies a mailing list, and if so, to return the membership of that list. The full name of the users (if known) and the fully specified mailboxes are returned in a multiline reply. This command has no effect on any of the reverse-path buffer, the forward-path buffer, or the mail data buffer. Syntax: "EXPN" SP String 4.1.1.8 HELP (HELP) This command causes the receiver to send helpful information to the sender of the HELP command. The command MAY take an argument (e.g., any command name) and return more specific information as a response. This command has no effect on any of the reverse-path buffer, the forward-path buffer, or the mail data buffer. SMTP servers SHOULD support HELP even if the form with an argument is not supported. Syntax: "HELP" [ SP String ] 4.1.1.9 NOOP (NOOP) This command does not affect any parameters or previously entered commands. It specifies no action other than that the receiver send an OK reply. This command has no effect on any of the reverse-path buffer, the forward-path buffer, or the mail data buffer. Syntax: "NOOP" [SP String] 4.1.1.10 QUIT (QUIT) This command specifies that the receiver must send an OK reply, and then close the transmission channel. The receiver MUST NOT intentionally close the transmission channel until it receives and replies to a QUIT command (even if there was an error). The sender MUST NOT intentionally close the transmission channel until it send a QUIT command and receives the reply (even if there was an error response to a previous command). If the connection is closed prematurely due to violations of the above or system or network failure the server MUST act as if a RSET command had been received (cancelling any pending transaction, but not undoing any previously completed transaction) and the client MUST act as if the command or transaction in progress had received a temporary error (4xx). Syntax: "QUIT" 4.1.2. LOWER-LEVEL SYNTAX The syntax of the argument fields of the above commands (using the syntax specified in [ABNF] where applicable) is given below. Reverse-path ::= Path Forward-path ::= Path Path ::= "<" [ A-d-l ":" ] <mailbox> ">" A-d-l ::= At-domain *( "," A-d-l ) At-domain ::= "@" Domain Mail-parameters ::= *( SP Keyword "=" Argument ) Rcpt-parameters ::= *( SP Keyword "=" Argument ) Keyword ::= String <<>>??? Argument ::= String <<>>??? Domain ::= sub-domain 1*("." sub-domain) | domain-literal sub-domain ::= let-dig *(ldh-str) domain-literal = "[" IP-address-literal "]" IP-address-literal = snum 3*("." snum) snum = one, two, or three digits representing a decimal integer value in the range 0 through 255 let-dig = Alpha / Digit ldh-str = *( Alpha / Digit / "-" ) 1*(let-dig) Alpha = ASCII character in the range A-Z or a-z. As specified in the domain name system definition [RFC-DNS], case is not significant in domain strings. Digit = 0 - 9 Mailbox ::= Local-part "@" Domain Local-part ::= Dot-string | Quoted-string While the definition for Local-part above is relatively permissive, for maximum interoperability, a host that expects to receive mail SHOULD avoid defining mailboxes where the Local-part requires (or uses) the Quoted-string form or where the Local-part is case-sensitive. Systems MUST NOT define mailboxes in such a way as to require the use of non-ASCII characters (octets with the high order bit set to one) or ASCII "control characters" (decimal value 0-31 and 127). These characters MUST NOT be used in MAIL FROM or RCPT TO commands or other commands that require mailbox names. <<?>> <string> ::= <char> | <char> <string> <<?>> <quoted-string> ::= """ <qtext> """ <<?>> <qtext> ::= "\" <x> | "\" <x> <qtext> | <q> | <q> <qtext> <char> ::= <c> | "\" <x> <number> ::= <d> | <d> <number> <CRLF> ::= <CR> <LF> <CR> ::= the carriage return character (ASCII code 13) <LF> ::= the line feed character (ASCII code 10) <SP> ::= the space character (ASCII code 32) <snum> ::= one, two, or three digits representing a decimal integer value in the range 0 through 255 <a> ::= any one of the 52 alphabetic characters A through Z in upper case and a through z in lower case <c> ::= any one of the 128 ASCII characters, but not any <special> or <SP> <d> ::= any one of the ten digits 0 through 9 <q> ::= any one of the 128 ASCII characters except <CR>, <LF>, quote ("), or backslash (\) <x> ::= any one of the 128 ASCII characters (no exceptions) <special> ::= "<" | ">" | "(" | ")" | "[" | "]" | "\" | "." | "," | ";" | ":" | "@" """ | the control characters (ASCII codes 0 through 31 inclusive and 127) Note that the backslash, "\", is a quote character, which is used to indicate that the next character is to be used literally (instead of its normal interpretation). For example, "Joe\,Smith" could be used to indicate a single nine character user field with comma being the fourth character of the field. Characters outside the set of specials, alphas, digits, and hyphen are prohibited by the domain name system definition and MUST NOT appear in domain names. In particular, the underscore character is not permitted. Sometimes a host is not known to the translation function and communication is blocked. To bypass this barrier a numeric form is also allowed for host "names". This form uses four or more small decimal integers separated by dots and enclosed by brackets, e.g., "[123.255.37.2]", which indicates an Internet Address in sequence-of-octets form. The time stamp line and the return path line are formally defined as follows: <return-path-line> ::= "Return-Path:" <SP><reverse-path><CRLF> <time-stamp-line> ::= "Received:" <SP> <stamp> <CRLF> <stamp> ::= <from-domain> <by-domain> <opt-info> ";" <daytime> <from-domain> ::= "FROM" <SP> <domain> <SP> <by-domain> ::= "BY" <SP> <domain> <SP> <opt-info> ::= [<via>] [<with>] [<id>] [<for>] <via> ::= "VIA" <SP> <link> <SP> <with> ::= "WITH" <SP> <protocol> <SP> <id> ::= "ID" <SP> <string> <SP> <for> ::= "FOR" <SP> <path> <SP> <<>>FOR and <link> need to be nailed down. <link> ::= The standard names for links are registered with the Internet Assigned Numbers Authority (IANA). <protocol> ::= The standard names for protocols are registered with the Internet Assigned Numbers Authority (IANA). <daytime> ::= <SP> <date> <SP> <time> <date> ::= <dd> <SP> <mon> <SP> <yyyy> Note that the earlier form, which permits two-digit years, is deprecated. SMTP systems SHOULD use four-digit years. <time> ::= <hh> ":" <mm> ":" <ss> <SP> <zone> <dd> ::= the one or two decimal integer day of the month in the range 1 to 31. <mon> ::= "JAN" | "FEB" | "MAR" | "APR" | "MAY" | "JUN" | "JUL" | "AUG" | "SEP" | "OCT" | "NOV" | "DEC" <yyyy> ::= the four decimal integer year in the range 0000 to 9999. <hh> ::= the two decimal integer hour of the day in the range 00 to 24. <mm> ::= the two decimal integer minute of the hour in the range 00 to 59. <ss> ::= the two decimal integer second of the minute in the range 00 to 59. <zone> ::= A four-digit time zone offset, such as -0600 for US Eastern Standard Time. This may be supplemented by a time zone name in parentheses, e.g., "-0800 (PDT)". See ??? for additional discussion. Note that there is no default; time zone information is required and MUST be supplied. ------------------------------------------------------------- | | Return Path Example | | Return-Path: <@CHARLIE.ARPA,@BAKER.ARPA:JOE@ABLE.ARPA> | | Example 9 | ------------------------------------------------------------- ------------------------------------------------------------- | | Time Stamp Line Example | | Received: FROM ABC.ARPA BY XYZ.ARPA ; 22 OCT 81 | 09:23:59 PDT | | Received: from ABC.ARPA by XYZ.ARPA via TELENET with X25 | id M12345 for Smith@PDQ.ARPA ; 22 OCT 81 09:23:59 PDT | | Example 10 | -------------------------------------------------------------- 4.1.3. Order of commands There are restrictions on the order in which these commands may be used. A session that is to contain mail transactions MUST first be initialized by the use of the HELO or EHLO command. An SMTP server SHOULD accept commands for non-mail transactions (e.g., VRFY or EXPN) without this initialization. HELO or EHLO commands MAY be issued by a client later in the session. If either is issued after the session begins, the SMTP server MUST clear all buffers and state as if an RSET command had been issued. In other words, the sequence of RSET followed immediately by HELO is redundant, but not harmful other than in the performance cost of executing unnecessary commands. If the HELO or EHLO commands are not acceptable to the SMTP server, 501, 500, or 502 failure replies MUST be returned as appropriate. The SMTP server must stay in the same state after transmitting these replies as it was in before the HELO or EHLO were received. RFC 1123 contains a discussion of arguments to HELO and conditions under which the HELO command can be rejected. In particular, HELO (or EHLO) MUST NOT be rejected because the client's putative name does not match some criteria established by the server (e.g., verification of reverse DNS mapping). The NOOP, HELP, EXPN, VRFY, and RSET commands can be used at any time during a session, or without previously initializing a session. SMTP servers SHOULD process these normally (i.e., not return a 503 code) even if no HELO or EHLO command has yet been received; clients SHOULD open a session with HELO or EHLO before sending these commands. If the above rules are followed, the example in RFC 821 that shows "550 access denied to you" in response to an EXPN command is essentially meaningless unless a HELO or EHLO command preceeds the EXPN or the denial of access is based on the client's IP address. The MAIL, SEND, SOML, or SAML commands begin a mail transaction. Once started a mail transaction consists of one of the transaction beginning commands, one or more RCPT commands, and a DATA command, in that order. A mail transaction may be aborted by the RSET command. There may be zero or more transactions in a session. If the transaction beginning command argument is not acceptable a 501 failure reply MUST be returned and the SMTP server must stay in the same state. If the commands in a transaction are out of order to the degree that they cannot be processed by the server a 503 failure reply MUST be returned and the SMTP server must stay in the same state. The last command in a session must be the QUIT command. The QUIT command can not be used at any other time in a session, but may be used by the client SMTP to request connection-closing even if no session-opening command has been sent and accepted. 4.1.4 Private-use commands Commands starting in "X" may be used by bilateral agreement between the client (sending) and server (receiving) SMTPs. An SMTP server that does not recognize such a command is expected to reply with "500 Command not recognized". An extended SMTP server MAY list the feature names associated with these private commands in the response to the EHLO command. Commands sent or accepted by SMTP systems that do not start with "X" MUST be documented in published RFCs and be at least candidates for standardization. 4.2. SMTP REPLIES Replies to SMTP commands are devised to ensure the synchronization of requests and actions in the process of mail transfer, and to guarantee that the SMTP client always knows the state of the SMTP server. Every command must generate exactly one reply. The details of the command-reply sequence are made explicit in Section ##4.3 on Sequencing. An SMTP reply consists of a three digit number (transmitted as three alphanumeric characters) followed by some text. The number is intended for use by automata to determine what state to enter next; the text is meant for the human user. It is intended that the three digits contain enough encoded information that the SMTP client need not examine the text and may either discard it or pass it on to the user, as appropriate. In particular, the text may be receiver-dependent and context dependent, so there are likely to be varying texts for each reply code. A discussion of the theory of reply codes is given in Appendix E. Formally, a reply is defined to be the sequence: a three-digit code, SP, one line of text, and CRLF, or a multiline reply (as defined in Appendix E). Only the EXPN and HELP commands are expected to result in multiline replies in normal circumstances, however multiline replies are allowed for any command. An SMTP server SHOULD send only the reply codes listed in this document. An SMTP server SHOULD use the text shown in the examples whenever appropriate. A client SMTP MUST determine its actions only by the reply code, not by the text (except for 251 and 551 replies); any text, including no text at all, must be acceptable. The space (blank) following the reply code is considered part of the text. Whenever possible, a sender-SMTP SHOULD test only the first digit of the reply code. 4.2.1. REPLY CODES BY FUNCTION GROUPS 500 Syntax error, command unrecognized [This may include errors such as command line too long] 501 Syntax error in parameters or arguments 502 Command not implemented (see section ##4.2.3) 503 Bad sequence of commands 504 Command parameter not implemented 211 System status, or system help reply 214 Help message [Information on how to use the receiver or the meaning of a particular non-standard command; this reply is useful only to the human user] 220 <domain> Service ready 221 <domain> Service closing transmission channel 421 <domain> Service not available, closing transmission channel [This may be a reply to any command if the service knows it must shut down] 250 Requested mail action okay, completed 251 User not local; will forward to <forward-path> 252 Cannot VRFY user, but will accept message and attempt delivery 450 Requested mail action not taken: mailbox unavailable [E.g., mailbox busy] 550 Requested action not taken: mailbox unavailable [E.g., mailbox not found, no access] 451 Requested action aborted: error in processing 551 User not local; please try <forward-path> 452 Requested action not taken: insufficient system storage 552 Requested mail action aborted: exceeded storage allocation 553 Requested action not taken: mailbox name not allowed [E.g., mailbox syntax incorrect] 354 Start mail input; end with <CRLF>.<CRLF> 554 Transaction failed 4.2.2. NUMERIC ORDER LIST OF REPLY CODES 211 System status, or system help reply 214 Help message [Information on how to use the receiver or the meaning of a particular non-standard command; this reply is useful only to the human user] 220 <domain> Service ready 221 <domain> Service closing transmission channel 250 Requested mail action okay, completed 251 User not local; will forward to <forward-path> 252 Cannot VRFY user, but will accept message and attempt delivery 354 Start mail input; end with <CRLF>.<CRLF> 421 <domain> Service not available, closing transmission channel [This may be a reply to any command if the service knows it must shut down] 450 Requested mail action not taken: mailbox unavailable [E.g., mailbox busy] 451 Requested action aborted: local error in processing 452 Requested action not taken: insufficient system storage 500 Syntax error, command unrecognized [This may include errors such as command line too long] 501 Syntax error in parameters or arguments 502 Command not implemented 503 Bad sequence of commands 504 Command parameter not implemented 550 Requested action not taken: mailbox unavailable [E.g., mailbox not found, no access] 551 User not local; please try <forward-path> 552 Requested mail action aborted: exceeded storage allocation 553 Requested action not taken: mailbox name not allowed [E.g., mailbox syntax incorrect] 554 Transaction failed 4.2.3. Reply code 502 Questions have been raised as to when reply code 502 (Command not implemented) should be returned in preference to other codes. 502 SHOULD be used when the command is actually recognized by the SMTP server, but not implemented. If the command is not recognized, code 500 SHOULD be returned. Extended SMTP systems MUST NOT list capabilities in response to EHLO for which they will return 502 (or 500) replies. 4.2.4 Reply codes after DATA and the subsequent CRLF.CRLF. When an SMTP server returns a positive completion status (2yz code) after the DATA command is completed with CRLF.CRLF, it accepts responsibity for: + delivering the message (if the recipient mailbox exists), or + if attempts to deliver the message fail due to transient conditions, retrying delivery some reasonable number of times at intervals as specified in RFC 1123, or + if attempts to deliver the message fail due to permanent conditions, or if repeated attempts to deliver the message fail due to transient conditions, returning appropriate notification to the sender of the original message (using the address in the SMTP MAIL FROM command). When an SMTP server returns a transient error completion status (4yz) code after the DATA command is completed with CRLF.CRLF, it MUST NOT make any further attempt to deliver that message. The SMTP client retains responsibility for delivery of that message. The sending user should be able to interpret the return of a transient or permanent failure status as a non-delivery indication. 4.3. SEQUENCING OF COMMANDS AND REPLIES 4.3.1 Sequencing overview The communication between the sender and receiver is intended to be an alternating dialogue, controlled by the sender. As such, the sender issues a command and the receiver responds with a reply. Unless other arrangements are negotiated through service extensions, the sender must wait for this response before sending further commands. One important reply is the connection greeting. Normally, a receiver will send a 220 "Service ready" reply when the connection is completed. The sender should wait for this greeting message before sending any commands. Note: all the greeting type replies have the official name (i.e., the fully-qualified primary domain name) of the server host as the first word following the reply code. When the host has no name, the IP address should be used, in bracketed dotted-octet format, e.g., [10.0.0.6]. For example, 220 <SP> USC-ISIF.ARPA <SP> Service ready <CRLF> The table below lists alternative success and failure replies for each command. These must be strictly adhered to; a receiver may substitute text in the replies, but the meaning and action implied by the code numbers and by the specific command reply sequence cannot be altered. COMMAND-REPLY SEQUENCES Each command is listed with its usual possible replies. The prefixes used before the possible replies are "P" for preliminary (not used in SMTP), "I" for intermediate, "S" for success, "F" for failure, and "E" for error. The 421 reply (service not available, closing transmission channel) may be given to any command if the SMTP-receiver knows it must shut down. Since some servers may generate other replies under special circumstances, and to allow for future extension, SMTP clients SHOULD, when possible, interpret only the first digit of the reply and MUST be prepared to deal with unrecognized reply codes by interpreting the first digit only. SMTP servers MUST NOT transmit reply codes to an SMTP client that are other than three digits or that do not start in a digit between 2 and 5 inclusive. CONNECTION ESTABLISHMENT S: 220 F: 421 HELO S: 250 E: 500, 501, 504, 421 MAIL S: 250 F: 552, 451, 452 E: 500, 501, 421 RCPT S: 250, 251 (but see section ##<<<>>> for discussion of 251) F: 550, 551, 552, 553, 450, 451, 452 E: 500, 501, 503, 421 DATA I: 354 -> data -> S: 250 F: 552, 554, 451, 452 F: 451, 554 E: 500, 501, 503, 421 RSET S: 250 E: 500, 501, 504, 421 SEND S: 250 F: 552, 451, 452 E: 500, 501, 502, 421 SOML S: 250 F: 552, 451, 452 E: 500, 501, 502, 421 SAML S: 250 F: 552, 451, 452 E: 500, 501, 502, 421 VRFY S: 250, 251, 252 F: 550, 551, 553 E: 500, 501, 502, 504, 421 EXPN S: 250, 252 F: 550 E: 500, 501, 502, 504, 421 HELP S: 211, 214 E: 500, 501, 502, 504, 421 NOOP S: 250 E: 500, 421 QUIT S: 221 E: 500 TURN S: 250 F: 502 E: 500, 503 4.4 Trace information When an SMTP server receives a message for delivery or further processing, it MUST insert trace ("time stamp" or "Received") information at the beginning of the message body, as discussed under the DATA command in section ##4.1.1.4. This line must be structured as follows: * The FROM field SHOULD contain both (1) the name of the source host as presented in the EHLO or HELO command and (2) a domain literal containing the IP address of the source, determined from the TCP connection. * The ID field MAY contain an "@" as suggested in RFC-822, but this is not required. * The FOR field MAY contain a list of <path> entries when multiple RCPT commands have been given. An Internet mail program MUST NOT change a Received: line that was previously added to the message header. As the Internet grows, comparability of Received fields is important for detecting problems, especially slow relays. SMTP servers that create Received fields SHOULD use explicit offsets in the dates (e.g., -0800), rather than time zone names of any type. Local time (with an offset) is preferred to UTF when feasible. If it is desired to also use a time zone name, it should be included in a commment. When the SMTP server makes the "final delivery" of a message it inserts a return-path line at the beginning of the mail data. This use of return-path is required; mail systems MUST support it. The return path line preserves the information in the <reverse-path> from the MAIL command. Here, final delivery means the message leaves the SMTP world. Normally, this would mean it has been delivered to the destination user, but in some cases it may be further processed and transmitted by another mail system. It is possible for the mailbox in the return path be different from the actual sender's mailbox, for example, if error responses are to be delivered a special error handling mailbox rather than to that of the message sender. When mailing lists are involved, this arrangement is common and useful as a means of directing errors to the list maintainer rather than the message originator. The preceding two paragraphs imply that the final mail data will begin with a return path line, followed by one or more time stamp lines. These lines will be followed by the mail data header and body [RFC822]. See Example 8. It is sometimes difficult for an SMTP server to determine whether or not it is making final delivery since forwarding or other operations may occur after the message is accepted for delivery. However any further (forwarding, gateway, or relay) systems MAY remove the return path and rebuild the MAIL FROM command as needed to ensure that exactly one such line appears in a delivered message. A message-originating SMTP system SHOULD NOT send a message that already contains a Return-path header. If a message that contains more than one Return-path header is received, only the first Return-path header line in the message header is valid. A message header processor SHOULD discard or, if necessary just ignore, any Return-path headers following the first one. The primary intent of the Return-path is that it designates the address to which messages indicating non-delivery or other mail system failures at to be sent. For this to be unambigious, exactly one return path should be present when the message is delivered. Systems using RFC 822 syntax with non-SMTP transports SHOULD preserve the intent of having an unambiguous address, associated with the transport envelope, to which to send error reports (e.g., non-delivery messages). Historical note: Text in RFC 822 that appears to contradict the use of Return-path (or the envelope MAIL FROM address) as the destination of error messages is not applicable on the Internet. The MAIL FROM address (as copied into the Return-path) MUST be used as the target of any mail containing delivery error messages. In particular, (i) a gateway from SMTP->elsewhere SHOULD insert a return-path header, unless it is known that the "elsewhere" transport also uses Internet domain addresses and maintains the envelope sender address separately. (ii) a gateway from elsewhere->SMTP SHOULD delete any return-path header present in the message, and either copy that information to the SMTP envelope or combine it with information present in the envelope of the other transport system to construct the MAIL FROM part of the SMTP envelope. Special mention is needed of the response and further action required when the processing following the end of mail data indication is partially successful. This could arise if after accepting several recipients and the mail data, the SMTP server finds that the mail data can be successfully delivered to some of the recipients, but it cannot be to others (for example, due to mailbox space allocation problems). In such a situation, the response to the DATA command must be an OK reply. But, the SMTP server must compose and send an "undeliverable mail" notification message to the originator of the message. Either a single notification which lists all of the recipients that failed to get the message, or separate notification messages must be sent for each failed recipient (see Example 7). All undeliverable mail notification messages are sent using the MAIL command (even if they result from processing the obsolete SEND, SOML, or SAML commands). ------------------------------------------------------------- | | Example of Return Path and Received Time Stamps | | Return-Path: <@GHI.ARPA,@DEF.ARPA,@ABC.ARPA:JOE@ABC.ARPA> | Received: from GHI.ARPA by JKL.ARPA ; 27 Oct 81 15:27:39 -0800 | Received: from DEF.ARPA by GHI.ARPA ; 27 Oct 81 15:15:13 -0800 | Received: from ABC.ARPA by DEF.ARPA ; 27 Oct 81 15:01:59 -0800 | Date: 27 Oct 81 15:01:01 -0800 (PST) | From: JOE@ABC.ARPA | Subject: Improved Mailing System Installed | To: SAM@JKL.ARPA | | This is to inform you that ... | | Example 8 | ------------------------------------------------------------- 4.5. DETAILS 4.5.1. MINIMUM IMPLEMENTATION In order to make SMTP workable, the following minimum implementation is required for all receivers: COMMANDS -- HELO VRFY MAIL RCPT DATA RSET NOOP QUIT Any system that includes an SMTP server that supports RCPT MUST support the reserved mailbox "Postmaster" as a case-insensitive mailbox name. EHLO SHOULD be supported if possible. 4.5.2. TRANSPARENCY Without some provision for data transparency the character sequence "<CRLF>.<CRLF>" ends the mail text and cannot be sent by the user. In general, users are not aware of such "forbidden" sequences. To allow all user composed text to be transmitted transparently the following procedures are used. 1. Before sending a line of mail text the SMTP client checks the first character of the line. If it is a period, one additional period is inserted at the beginning of the line. 2. When a line of mail text is received by the SMTP server it checks the line. If the line is composed of a single period it is the end of mail. If the first character is a period and there are other characters on the line, the first character is deleted. The mail data may contain any of the 128 ASCII characters. All characters are to be delivered to the recipient's mailbox including format effectors and other control characters. If the transmission channel provides an 8-bit byte (octets) data stream, the 7-bit ASCII codes are transmitted right justified in the octets with the high order bits cleared to zero. In some systems it may be necessary to transform the data as it is received and stored. This may be necessary for hosts that use a different character set than ASCII as their local character set, or that store data in records rather than strings. If such transforms are necessary, they must be reversible -- especially if such transforms are applied to mail being relayed. 4.5.3. SIZES AND TIMEOUTS There are several objects that have required minimum maximum sizes. That is, every implementation must be able to receive objects of at least these sizes, but must not send objects larger than these sizes. **************************************************** * * * TO THE MAXIMUM EXTENT POSSIBLE, IMPLEMENTATION * * TECHNIQUES WHICH IMPOSE NO LIMITS ON THE LENGTH * * OF THESE OBJECTS SHOULD BE USED. * * * **************************************************** user The maximum total length of a user name is 64 characters. domain The maximum total length of a domain name or number is 64 characters. path The maximum total length of a reverse-path or forward-path is 256 characters (including the punctuation and element separators). command line The maximum total length of a command line including the command word and the <CRLF> is 512 characters. reply line The maximum total length of a reply line including the reply code and the <CRLF> is 512 characters. text line The maximum total length of a text line including the <CRLF> is 1000 characters (but not counting the leading dot duplicated for transparency). This number may be increased by the use of SMTP Service Extensions. message body The maximum total length of a message body (including any message headers) MUST BE at least 64K octets. Especially since the introduction of multimedia mail [RFC-MIME], message lengths on the Internet have grown dramatically, and message size restrictions should be avoided if at all possible. SMTP server systems that must impose restrictions SHOULD implement the "SIZE" service extension ([RFC-SIZE]) and SMTP client systems that will send large messages SHOULD utilize it when possible. recipients buffer The maximum total number of recipients that must be buffered is 100 recipients. **************************************************** * * * TO THE MAXIMUM EXTENT POSSIBLE, IMPLEMENTATION * * TECHNIQUES WHICH IMPOSE NO LIMITS ON THE LENGTH * * OF THESE OBJECTS SHOULD BE USED. * * * **************************************************** Errors due to exceeding these limits may be reported by using the reply codes, for example: 500 Line too long. 501 Path too long 552 Too many recipients. 552 Too much mail data. An SMTP client should provide timeouts for all commands. Minimum values SHOULD be as follows: o Initial 220 Message: 5 minutes An SMTP client process needs to distinguish between a failed TCP connection and a delay in receiving the initial 220 greeting message. Many SMTP servers will accept a TCP connection but delay delivery of the 220 message until their system load will permit more mail to be processed. o MAIL Command: 5 minutes o RCPT Command: 5 minutes A longer timeout would be required if processing of mailing lists and aliases were not deferred until after the message was accepted. o DATA Initiation: 2 minutes This is while awaiting the "354 Start Input" reply to a DATA command. o Data Block: 3 minutes This is while awaiting the completion of each TCP SEND call transmitting a chunk of data. o DATA Termination: 10 minutes. This is while awaiting the "250 OK" reply. When the receiver gets the final period terminating the message data, it typically performs processing to deliver the message to a user mailbox. A spurious timeout at this point would be very wasteful, since the message has been successfully sent. An SMTP server SHOULD have a timeout of at least 5 minutes while it is awaiting the next command from the sender. 4.5.4 Queuing Strategies The common structure of a host SMTP implementation includes user mailboxes, one or more areas for queueing messages in transit, and one or more daemon processes for sending and receiving mail. The exact structure will vary depending on the needs of the users on the host and the number and size of mailing lists supported by the host. We describe several optimizations that have proved helpful, particularly for mailers supporting high traffic levels. Any queueing strategy MUST include: o Timeouts on all activities on a per-command basis o Never sending error messages in response to error messages. 4.5.4.1 Sending Strategy The general model of an SMTP client is one or more processes that periodically attempt to transmit outgoing mail. In a typical system, the program that composes a message has some method for requesting immediate attention for a new piece of outgoing mail, while mail that cannot be transmitted immediately MUST be queued and periodically retried by the sender. A mail queue entry will include not only the message itself but also the envelope information. The sender MUST delay retrying a particular destination after one attempt has failed. In general, the retry interval SHOULD be at least 30 minutes; however, more sophisticated and variable strategies will be beneficial when the SMTP client can determine the reason for non- delivery. Retries continue until the message is transmitted or the sender gives up; the give-up time generally needs to be at least 4-5 days. The parameters to the retry algorithm MUST be configurable. A sender SHOULD keep a list of hosts it cannot reach and corresponding connection timeouts, rather than just retrying queued mail items. DISCUSSION: Experience suggests that failures are typically transient (the target system has crashed), favoring a policy of two connection attempts in the first hour the message is in the queue, and then backing off to once every two or three hours. The SMTP client can shorten the queueing delay by cooperation with the SMTP server. In particular, if mail is received from a particular address, it is good evidence that any mail queued for that host can now be sent. The strategy may be further modified as a result of multiple addresses per host (see Section ##5.??.??), to optimize delivery time vs. resource usage. an SMTP client may have a large queue of messages for each unavailable destination host, and if it retried all these messages in every retry cycle, there would be excessive Internet overhead and the daemon would be blocked for a long period. Note that an SMTP can generally determine that a delivery attempt has failed only after a timeout of a minute or more; a one minute timeout per connection will result in a very large delay if it is repeated for dozens or even hundreds of queued messages. When the same message is to be delivered to several users on the same host, only one copy of the message SHOULD be transmitted. That is, the SMTP client should use the command sequence: RCPT, RCPT,... RCPT, DATA instead of the sequence: RCPT, DATA, RCPT, DATA,... RCPT, DATA. Implementation of this efficiency feature is strongly urged. Similarly, the SMTP client MAY support multiple concurrent outgoing mail transactions to achieve timely delivery. However, some limit SHOULD be imposed to protect the host from devoting all its resources to mail. 4.5.4.2 Receiving strategy The SMTP server SHOULD attempt to keep a pending listen on the SMTP port at all times. This will require the support of multiple incoming TCP connections for SMTP. Some limit MAY be imposed. IMPLEMENTATION: When the SMTP server receives mail from a particular host address, it could notify the SMTP client to retry any mail pending for that host address. 5. Address resolution and mail handling Once an SMTP client lexically identifies a domain to which mail is to be delivered for processing (as described in sections ##3.6 and ##3.7), a DNS lookup is performed to resolve that domain name (see [RFC-DNS]). The lookup first attempts to locate an MX record associated with that name. If a CNAME record is found instead, the resulting name is processed as if it were the initial name. When the lookup succeeds, the mapping can result in a list of alternative delivery addresses rather than a single address, because of (a) multiple MX records, (b) multihoming, or both. To provide reliable mail transmission, the SMTP client MUST be able to try (and retry) each of the addresses in this list in order, until a delivery attempt succeeds. However, there MAY also be a configurable limit on the number of alternate addresses that can be tried. In any case, a host SHOULD try at least two addresses. The following information is to be used to rank the host addresses: (1) Multiple MX Records -- these contain a preference indication that should be used in sorting. If there are multiple destinations with the same preference and there is no clear reason to favor one (e.g., by address preference), then the sender-SMTP SHOULD pick one at random to spread the load across multiple mail exchanges for a specific organization; note that this is a refinement of the procedure in [DNS:3]. (2) Multihomed host -- The destination host (perhaps taken from the preferred MX record) may be multihomed, in which case the domain name resolver will return a list of alternative IP addresses. It is the responsibility of the domain name resolver interface to have ordered this list by decreasing preference, and SMTP MUST try them in the order presented. DISCUSSION: Although the capability to try multiple alternative addresses is required, there may be circumstances where specific installations want to limit or disable the use of alternative addresses. The question of whether a sender should attempt retries using the different addresses of a multihomed host has been controversial. The main argument for using the multiple addresses is that it maximizes the probability of timely delivery, and indeed sometimes the probability of any delivery; the counter argument is that it may result in unnecessary resource use. Note that resource use is also strongly determined by the sending strategy discussed in Section #??.??.?? 6. Problem detection and handling 6.1 Reliable delivery and replies by email When the receiver-SMTP accepts a piece of mail (by sending a "250 OK" message in response to DATA), it is accepting responsibility for delivering or relaying the message. It must take this responsibility seriously, i.e., it MUST NOT lose the message for frivolous reasons, e.g., because the host later crashes or because of a predictable resource shortage. If there is a delivery failure after acceptance of a message, the receiver-SMTP MUST formulate and mail a notification message. This notification MUST be sent using a null ("<>") reverse path in the envelope. The recipient of this notification SHOULD be the address from the envelope return path (or the Return-Path: line). However, if this address is null ("<>"), the receiver-SMTP MUST NOT send a notification. If the address is an explicit source route, it MUST be stripped down to its final hop. DISCUSSION: For example, suppose that an error notification must be sent for a message that arrived with: "MAIL FROM:<@a,@b:user@d>". The notification message should be sent to: "RCPT TO:<user@d>". Some delivery failures after the message is accepted by SMTP will be unavoidable. For example, it may be impossible for the receiving SMTP server to validate all the delivery addresses in RCPT command(s) due to a "soft" domain system error, because the target is a mailing list (see earlier discussion of RCPT), or because the server is acting as a relay and has no immediate access to the delivering system. To avoid receiving duplicate messages as the result of timeouts, a receiver-SMTP MUST seek to minimize the time required to respond to the final "CRLF.CRLF" that ends a message transfer. See RFC-1047 [RFC1047] for a discussion of this problem. 6.2 Loop detection Simple counting of the number of Received lines in a message has not proven to be a desirable method of detecting loops in mail systems, and SMTP servers SHOULD NOT use that technique. Loop detection by examination of Received fields for the domain name or other signature of the SMTP server making the check is effective and MAY be used by SMTP servers. 6.3 Compensating for irregularities Unfortunately, variations, creative interpretations, and outright violations of Internet mail protocols do occur; some would suggest that they occur quite frequently. The debate as to whether a well-behaved SMTP receiver or relay should reject a malformed message, attempt to pass it on unchanged, or attempt to repair it to increase the odds of successful delivery (or subsequent reply) began almost with the dawn of structured network mail and shows no signs of abating. Advocates of rejection claim that attempted repairs are rarely completely adequate and that rejection of bad messages is the only way to get the offending software repaired. Advocates of "repair" or "deliver no matter what" argue that users prefer that mail go through it if at all possible and that there are significant market pressures in that direction. In practice, these market pressures may be more important to particular vendors then strict conformance to the standards, regardless of the preference of the actual developers. The problems associated with ill-formed messages were exacerbated by the introduction of the split-UA mail reading protocols [RFC-POP2, RFC-POP3, RFC-IMAP2, RFC-PCMAIL]. These protocols, which facilitate the use of a client machine to actually process incoming mail that is separate from the one containing the receiving SMTP, have encouraged the use of SMTP as a posting protocol and SMTP servers as relay systems for these client hosts, which are often only intermittently connected to the Internet. Historically, many of those client machines lacked some of the mechanisms and information assumed by SMTP (and indeed, by the mail format protocol [RFC-822]). Some could not keep adequate track of time; others had no concept of timezones; still others could not identify their own names or addresses; and, of course, none could satisfy the assumptions that underlay RFC-822's conception of authenticated addresses. In response to these weak SMTP clients, many SMTP systems have taken on the responsibility to complete messages that are delivered to them in incomplete or incorrect form. This strategy is generally considered to be appropriate when the server can identify or authenticate the client and there are prior agreements between them. By contrast, there is at best great concern about fixes applied by a relay or delivery SMTP server that has little or no knowledge of the user or client machine. The following changes to a message being processed MAY be applied by an SMTP server when necessary. The less information the server has about the client, the less likely these changes are to be correct and the more caution and conservatism should be applied in considering whether or not to perform fixes and how. In all cases, properly-operating clients that supply correct information are preferred to corrections by the SMTP server. And, equally in all cases, documentation of actions performed by the servers (in trace fields and/or header comments) is strongly encouraged. - Addition of a message-id field when none appears - Addition of a date, time or timezone when none appears - Correction of addresses to proper FQDN format 7. Security Considerations 7.1 Mail security and spoofing SMTP mail is inherently insecure in that it is feasible for even fairly casual users to negotiate directly with receiving and relaying SMTP servers and create messages that will trick a naive recipient into believing that they came from somewhere else. Constructing such a message so that the "spoofed" behavior cannot be detected by an expert is somewhat more difficult, but not sufficiently so as to be a deterrent to someone who is determined and knowledgeable. Consequently, as knowledge of Internet mail increases, so does the knowledge that SMTP mail inherently cannot be authenticated, or integrity checks provided, at the transport level. Real security lies only in end-to-end methods involving the message bodies, e.g., those that can be provided in the MOSS framework [RFC-MOSS]. A corollary to this is that efforts to make it more difficult for users to set envelope MAIL FROM and header "From" fields to point to valid addresses other than their own are largely misguided: they do not prevent any would-be mail spoofer from doing so, and do frustrate legitimate applications in which mail is sent by one user on behalf of another or in which error (or normal) replies should be directed to a special address. On the other hand, systems that provide convenient ways for users to alter these fields on a per-message basis should attempt to establish a primary and permanent mailbox address for the user so that Sender fields can be generated correctly. This specification does not further address the security issues associated with SMTP other than to advocate that useful functionality not be disabled in the hope of providing some small margin of protection against an ignorant user who is trying to fake mail. 7.2 "Blind" copies. Addresses may appear in the RCPT TO commands to an SMTP server that do not appear in the message headers for a number of reasons. The two most common of these involve the use of a mailing address as a "list exploder" -- a single address that resolves into multiple addresses -- and the appearance of "blind copies". In order to avoid defeating some of the purpose of these mechanisms, SMTP clients and servers SHOULD NOT copy the RCPT TO command arguments into the headers, even as informational or private-extension headers. Since this rule is often violated in practice, and cannot be enforced, sending SMTP systems that are aware of "bcc" use MAY find it helpful to send each blind copy as a separate message transaction containing only a single RCPT TO command. More generally, while there are often similarities, there is no inherent relationship between either "reverse" (MAIL FROM, SAML FROM, etc.) or "forward" (RCPT TO) addresses in the SMTP transaction ("envelope") and the addresses in the headers. Receiving systems SHOULD NOT attempt to deduce such relationships and use them to alter the headers of the message for delivery. The popular "Apparently-to" header is a violation of this principle and SHOULD NOT be used. See also section ##3.5.5. 8. REFERENCES [1] ASCII ASCII, "USA Code for Information Interchange", United States of America Standards Institute, X3.4, 1968. [RFC822] Crocker, D., "Standard for the Format of ARPA Internet Text Messages", RFC 822, Department of Electrical Engineering, University of Delaware, August 1982. [3] TCP Postel, J., ed., "Transmission Control Protocol - DARPA Internet Program Protocol Specification", RFC 793, USC/Information Sciences Institute, NTIS AD Number A111091, September 1981. Also in: Feinler, E. and J. Postel, eds., "Internet Protocol Transition Workbook", SRI International, Menlo Park, California, March 1982. [HEADER-PEOPLE] [RFC-DNS] P. Mockapetris, "Domain names - implementation and specification", RFC 1035 and P. Mockapetris, "Domain names - concepts and facilities", RFC 1034. (STD 13) [RFC 974] C. Partridge, "Mail routing and the domain system", 01/01/1986 [RFC1047] C. Partridge, "Duplicate messages and SMTP", RFC 1047, 02/01/1988. [RFC-SIZE] J. Klensin, N. Freed, K. Moore, "SMTP Service Extension for Message Size Declaration", RFC 1870, 11/06/1995. (STD 10) [8BITMIME] J. Klensin, N. Freed, M. Rose, E. Stefferud, D. Crocker, "SMTP Service Extension for 8bit-MIMEtransport", RFC 1652, 07/18/1994. [MSGFMT] P. Resnick, Work in progress, draft-ietf-drums-msg-fmt-00.txt, November 1996. [SMTPEX] J. Klensin, N. Freed, M. Rose, E. Stefferud, D. Crocker, "SMTP Service Extensions", RFC-1869, 11/06/1995. [RFC-1123] R. Braden, "Requirements for Internet hosts - application and support", 10/01/1989 [RFC-MOSS] S. Crocker, N. Freed, J. Galvin, S. Murphy, "MIME Object Security Services", RFC 1848, 10/03/1995. [RFC-POP2] M. Butler, D. Chase, J. Goldberger, J. Postel, J. Reynolds, "Post Office Protocol - version 2", RFC 937, 02/01/1985 [RFC-IMAP2] M. Crispin, "Interactive Mail Access Protocol - Version 2", RFC 1176, 08/20/1990. [RFC-PCMAIL] M. Lambert, "PCMAIL: A distributed mail system for personal computers", RFC 1056, 06/01/1988. [RFC-POP3] J. Myers, M. Rose, "Post Office Protocol - Version 3", RFC 1930, 5/14/96 (Std 53). [RFC-IMAP4] M. Crispin, "Internet Message Access Protocol - Version 4", RFC 1730, 12/20/1994. [ABNF] Crocker, D., "Augmented BNF for Syntax Specifications: ABNF", (in progress -- draft-ietf-drums-abnf-01.txt) 9. Editor's Addresses John C. Klensin MCI Communications 800 Boylston St, 7th floor Boston, MA 02199 USA Email: Klensin@mci.net Phone: +1 617 960 1011 Fax: +1 617 960 1009 10. Acknowledgements <<to be supplied>> APPENDIX A TCP Transport service The Transmission Control Protocol [3] is used in the Internet, and in any network following the Internet standards for internetwork protocols. Connection Establishment The SMTP transmission channel is a TCP connection established between the sender process port U and the receiver process port L. This single full duplex connection is used as the transmission channel. This protocol is assigned the service port 25 (31 octal), that is L=25. Data Transfer The TCP connection supports the transmission of 8-bit bytes. The SMTP data is 7-bit ASCII characters. Each character is transmitted as an 8-bit byte with the high-order bit cleared to zero. APPENDIX B Generating SMTP commands from RFC 822 headers Some systems use RFC 822 headers (only) in a mail submission protocol, or otherwise generate SMTP commands from RFC 822 headers when such a message is handed to an MTA from a UA. While the MTA-UA protocol is a private matter, not covered by any Internet Standard, there are problems with this approach. For example, there have been repeated problems with proper handling of "bcc" copies and redistribution lists when information that conceptually belongs to a mail envelopes is not separated early in processing from header information (and kept separate). It is recommended that the UA provide its initial MTA with an envelope separate from the message itself. However, if the envelope is not supplied, SMTP commands should be generated as follows: (i) each recipient addresses from a TO, CC, or BCC header field should be copied to a RCPT command (generating multiple message copies if that is required for queuing or delivery). This includes any addresses listed in a RFC 822 "group". Any BCC fields should then be removed from the headers. Once this process is completed, the remaining headers should be checked to verify that at least one To:, Cc:, or Bcc: header remains. If none do, then a bcc: header with no additional information SHOULD be inserted (see section ##2.15 above). (ii) the return address in the MAIL command should be derived from the system's identity for the submitting (local) user. That return address should also be copied to the Sender header field if it is different from the address in the From header field. (Any Sender field that was already there should be removed.) Systems may provide a way for submitters to override the envelope return address, but may want to restrict its use to privileged users. (This will not prevent mail forgery, but may lessen its incidence.) A submission protocol based on Standard RFC 822 information alone MUST NOT be used to gateway a message from a foreign (non-SMTP) mail system into an SMTP environment. Additional information to construct an envelope must come from some source in the other environment, whether supplemental headers or the foreign system's envelope. Attempts to gateway messages using only their header "to" and "cc" fields, have repeatedly caused mail loops and other behavior adverse to the proper functioning of the Internet mail environment. These problems have been especially common when the message originates from an Internet mailing list and is distributed into the foreign environment using envelope information. When these messages are then processed by a header-only remailer, loops back to the Internet environment (and the mailing list) are almost inevitable. APPENDIX E Theory of Reply Codes The three digits of the reply each have a special significance. The first digit denotes whether the response is good, bad or incomplete. An unsophisticated SMTP client will be able to determine its next action (proceed as planned, redo, retrench, etc.) by simply examining this first digit. An SMTP client that wants to know approximately what kind of error occurred (e.g., mail system error, command syntax error) may examine the second digit, reserving the third digit for the finest gradation of information. There are five values for the first digit of the reply code: 1yz Positive Preliminary reply The command has been accepted, but the requested action is being held in abeyance, pending confirmation of the information in this reply. The SMTP client should send another command specifying whether to continue or abort the action. [Note: SMTP does not have any commands that allow this type of reply, and so does not have the continue or abort commands.] 2yz Positive Completion reply The requested action has been successfully completed. A new request may be initiated. 3yz Positive Intermediate reply The command has been accepted, but the requested action is being held in abeyance, pending receipt of further information. The SMTP client should send another command specifying this information. This reply is used in command sequence groups. 4yz Transient Negative Completion reply The command was not accepted and the requested action did not occur. However, the error condition is temporary and the action may be requested again. The sender should return to the beginning of the command sequence (if any). It is difficult to assign a meaning to "transient" when two different sites (receiver- and sender- SMTPs) must agree on the interpretation. Each reply in this category might have a different time value, but the SMTP client is encouraged to try again. A rule of thumb to determine if a reply fits into the 4yz or the 5yz category (see below) is that replies are 4yz if they can be repeated without any change in command form or in properties of the sender or receiver. (E.g., the command is repeated identically and the receiver does not put up a new implementation.) 5yz Permanent Negative Completion reply The command was not accepted and the requested action did not occur. The SMTP client is discouraged from repeating the exact request (in the same sequence). Even some "permanent" error conditions can be corrected, so the human user may want to direct the SMTP client to reinitiate the command sequence by direct action at some point in the future (e.g., after the spelling has been changed, or the user has altered the account status). The second digit encodes responses in specific categories: x0z Syntax -- These replies refer to syntax errors, syntactically correct commands that don't fit any functional category, and unimplemented or superfluous commands. x1z Information -- These are replies to requests for information, such as status or help. x2z Connections -- These are replies referring to the transmission channel. x3z Unspecified as yet. x4z Unspecified as yet. x5z Mail system -- These replies indicate the status of the receiver mail system vis-a-vis the requested transfer or other mail system action. The third digit gives a finer gradation of meaning in each category specified by the second digit. The list of replies illustrates this. Each reply text is recommended rather than mandatory, and may even change according to the command with which it is associated. On the other hand, the reply codes must strictly follow the specifications in this section. Receiver implementations should not invent new codes for slightly different situations from the ones described here, but rather adapt codes already defined. For example, a command such as NOOP whose successful execution does not offer the SMTP client any new information will return a 250 reply. The response is 502 when the command requests an unimplemented non-site-specific action. A refinement of that is the 504 reply for a command that is implemented, but that requests an unimplemented parameter. The reply text may be longer than a single line; in these cases the complete text must be marked so the SMTP client knows when it can stop reading the reply. This requires a special format to indicate a multiple line reply. The format for multiline replies requires that every line, except the last, begin with the reply code, followed immediately by a hyphen, "-" (also known as minus), followed by text. The last line will begin with the reply code, followed immediately by <SP>, optionally some text, and <CRLF>. For example: 123-First line 123-Second line 123-234 text beginning with numbers 123 The last line In many cases the SMTP client then simply needs to search for the reply code followed by <SP> at the beginning of a line, and ignore all preceding lines. In a few cases, there is important data for the sender in the reply "text". The sender will know these cases from the current context. APPENDIX F Scenarios This section presents complete scenarios of several types of SMTP sessions. A Typical SMTP Transaction Scenario This SMTP example shows mail sent by Smith at host USC-ISIF, to Jones, Green, and Brown at host BBN-UNIX. Here we assume that host USC-ISIF contacts host BBN-UNIX directly. The mail is accepted for Jones and Brown. Green does not have a mailbox at host BBN-UNIX. ------------------------------------------------------------- R: 220 BBN-UNIX.ARPA Simple Mail Transfer Service Ready S: HELO USC-ISIF.ARPA R: 250 BBN-UNIX.ARPA S: MAIL FROM:<Smith@USC-ISIF.ARPA> R: 250 OK S: RCPT TO:<Jones@BBN-UNIX.ARPA> R: 250 OK S: RCPT TO:<Green@BBN-UNIX.ARPA> R: 550 No such user here S: RCPT TO:<Brown@BBN-UNIX.ARPA> R: 250 OK S: DATA R: 354 Start mail input; end with <CRLF>.<CRLF> S: Blah blah blah... S: ...etc. etc. etc. S: . R: 250 OK S: QUIT R: 221 BBN-UNIX.ARPA Service closing transmission channel Scenario 1 ------------------------------------------------------------- Aborted SMTP Transaction Scenario ------------------------------------------------------------- R: 220 MIT-Multics.ARPA Simple Mail Transfer Service Ready S: HELO ISI-VAXA.ARPA R: 250 MIT-Multics.ARPA S: MAIL FROM:<Smith@ISI-VAXA.ARPA> R: 250 OK S: RCPT TO:<Jones@MIT-Multics.ARPA> R: 250 OK S: RCPT TO:<Green@MIT-Multics.ARPA> R: 550 No such user here S: RSET R: 250 OK S: QUIT R: 221 MIT-Multics.ARPA Service closing transmission channel Scenario 2 ------------------------------------------------------------- Relayed Mail Scenario ------------------------------------------------------------- Step 1 -- Source Host to Relay Host R: 220 USC-ISIE.ARPA Simple Mail Transfer Service Ready S: HELO MIT-AI.ARPA R: 250 USC-ISIE.ARPA S: MAIL FROM:<JQP@MIT-AI.ARPA> R: 250 OK S: RCPT TO:<@USC-ISIE.ARPA:Jones@BBN-VAX.ARPA> R: 250 OK S: DATA R: 354 Start mail input; end with <CRLF>.<CRLF> S: Date: 2 Nov 81 22:33:44 S: From: John Q. Public <JQP@MIT-AI.ARPA> S: Subject: The Next Meeting of the Board S: To: Jones@BBN-Vax.ARPA S: S: Bill: S: The next meeting of the board of directors will be S: on Tuesday. S: John. S: . R: 250 OK S: QUIT R: 221 USC-ISIE.ARPA Service closing transmission channel Step 2 -- Relay Host to Destination Host R: 220 BBN-VAX.ARPA Simple Mail Transfer Service Ready S: HELO USC-ISIE.ARPA R: 250 BBN-VAX.ARPA S: MAIL FROM:<@USC-ISIE.ARPA:JQP@MIT-AI.ARPA> R: 250 OK S: RCPT TO:<Jones@BBN-VAX.ARPA> R: 250 OK S: DATA R: 354 Start mail input; end with <CRLF>.<CRLF> S: Received: from MIT-AI.ARPA by USC-ISIE.ARPA ; 2 Nov 81 22:40:10 UT S: Date: 2 Nov 81 22:33:44 S: From: John Q. Public <JQP@MIT-AI.ARPA> S: Subject: The Next Meeting of the Board S: To: Jones@BBN-Vax.ARPA S: S: Bill: S: The next meeting of the board of directors will be S: on Tuesday. S: John. S: . R: 250 OK S: QUIT R: 221 USC-ISIE.ARPA Service closing transmission channel Scenario 3 ------------------------------------------------------------- Verifying and Sending Scenario ------------------------------------------------------------- R: 220 SU-SCORE.ARPA Simple Mail Transfer Service Ready S: HELO MIT-MC.ARPA R: 250 SU-SCORE.ARPA S: VRFY Crispin R: 250 Mark Crispin <Admin.MRC@SU-SCORE.ARPA> S: SEND FROM:<EAK@MIT-MC.ARPA> R: 250 OK S: RCPT TO:<Admin.MRC@SU-SCORE.ARPA> R: 250 OK S: DATA R: 354 Start mail input; end with <CRLF>.<CRLF> S: Blah blah blah... S: ...etc. etc. etc. S: . R: 250 OK S: QUIT R: 221 SU-SCORE.ARPA Service closing transmission channel Scenario 4 ------------------------------------------------------------- Mailing List Scenario First each of two mailing lists are expanded in separate sessions with different hosts. Then the message is sent to everyone that appeared on either list (but no duplicates) via a relay host. ------------------------------------------------------------- Step 1 -- Expanding the First List R: 220 MIT-AI.ARPA Simple Mail Transfer Service Ready S: HELO SU-SCORE.ARPA R: 250 MIT-AI.ARPA S: EXPN Example-People R: 250-<ABC@MIT-MC.ARPA> R: 250-Fred Fonebone <Fonebone@USC-ISIQ.ARPA> R: 250-Xenon Y. Zither <XYZ@MIT-AI.ARPA> R: 250-Quincy Smith <@USC-ISIF.ARPA:Q-Smith@ISI-VAXA.ARPA> R: 250-<joe@foo-unix.ARPA> R: 250 <xyz@bar-unix.ARPA> S: QUIT R: 221 MIT-AI.ARPA Service closing transmission channel Step 2 -- Expanding the Second List R: 220 MIT-MC.ARPA Simple Mail Transfer Service Ready S: HELO SU-SCORE.ARPA R: 250 MIT-MC.ARPA S: EXPN Interested-Parties R: 250-Al Calico <ABC@MIT-MC.ARPA> R: 250-<XYZ@MIT-AI.ARPA> R: 250-Quincy Smith <@USC-ISIF.ARPA:Q-Smith@ISI-VAXA.ARPA> R: 250-<fred@BBN-UNIX.ARPA> R: 250 <xyz@bar-unix.ARPA> S: QUIT R: 221 MIT-MC.ARPA Service closing transmission channel Step 3 -- Mailing to All via a Relay Host R: 220 USC-ISIE.ARPA Simple Mail Transfer Service Ready S: HELO SU-SCORE.ARPA R: 250 USC-ISIE.ARPA S: MAIL FROM:<Account.Person@SU-SCORE.ARPA> R: 250 OK S: RCPT TO:<@USC-ISIE.ARPA:ABC@MIT-MC.ARPA> R: 250 OK S: RCPT TO:<@USC-ISIE.ARPA:Fonebone@USC-ISIQA.ARPA> R: 250 OK S: RCPT TO:<@USC-ISIE.ARPA:XYZ@MIT-AI.ARPA> R: 250 OK S: RCPT TO:<@USC-ISIE.ARPA,@USC-ISIF.ARPA:Q-Smith@ISI-VAXA.ARPA> R: 250 OK S: RCPT TO:<@USC-ISIE.ARPA:joe@FOO-UNIX.ARPA> R: 250 OK S: RCPT TO:<@USC-ISIE.ARPA:xyz@BAR-UNIX.ARPA> R: 250 OK S: RCPT TO:<@USC-ISIE.ARPA:fred@BBN-UNIX.ARPA> R: 250 OK S: DATA R: 354 Start mail input; end with <CRLF>.<CRLF> S: Blah blah blah... S: ...etc. etc. etc. S: . R: 250 OK S: QUIT R: 221 USC-ISIE.ARPA Service closing transmission channel Scenario 7 ------------------------------------------------------------- Too Many Recipients Scenario ------------------------------------------------------------- R: 220 BERKELEY.ARPA Simple Mail Transfer Service Ready S: HELO USC-ISIF.ARPA R: 250 BERKELEY.ARPA S: MAIL FROM:<Postel@USC-ISIF.ARPA> R: 250 OK S: RCPT TO:<fabry@BERKELEY.ARPA> R: 250 OK S: RCPT TO:<eric@BERKELEY.ARPA> R: 552 Recipient storage full, try again in another transaction S: DATA R: 354 Start mail input; end with <CRLF>.<CRLF> S: Blah blah blah... S: ...etc. etc. etc. S: . R: 250 OK S: MAIL FROM:<Postel@USC-ISIF.ARPA> R: 250 OK S: RCPT TO:<eric@BERKELEY.ARPA> R: 250 OK S: DATA R: 354 Start mail input; end with <CRLF>.<CRLF> S: Blah blah blah... S: ...etc. etc. etc. S: . R: 250 OK S: QUIT R: 221 BERKELEY.ARPA Service closing transmission channel Scenario 10 ------------------------------------------------------------- Note that a real implementation must handle many recipients as specified in Section ##4.5.3. APPENDIX G Other gateway issues. In general, gateways between the Internet and other mail systems SHOULD attempt to preserve any layering semantics across the boundaries between the two mail systems involved. Gateway- translation approaches that attempt to take shortcuts by mapping, e.g., envelope information from one system to the message headers or body of another have generally proven to be inadequate in important ways. Systems translating between environments that do not support both envelopes and headers and Internet mail must be written with the understanding that some information loss is almost inevitable. APPENDIX H GLOSSARY ASCII American Standard Code for Information Interchange [1]. command A request for a mail service action sent by the SMTP client to the SMTP server. domain The hierarchially structured global character string address of a host computer in the mail system. See section ##2.3. end of mail data indication A special sequence of characters that indicates the end of the mail data. In particular, the five characters carriage return, line feed, period, carriage return, line feed, in that order. host A computer in the internetwork environment on which mailboxes or SMTP processes reside. See section ##2.3. line A a sequence of ASCII characters ending with a <CRLF>. mail data A sequence of ASCII characters of arbitrary length, which conforms to the standard set in the Standard for the Format of ARPA Internet Text Messages (RFC 822 [RFC822]##[MSGFMT]). mailbox A character string (address) which identifies a user to whom mail is to be sent. Mailbox normally consists of the host and user specifications. The standard mailbox naming convention is defined to be "user@domain". Additionally, the "container" in which mail is stored. <<Is this terminology now consistent with the Message Format document??>> SMTP server process A process which transfers mail in cooperation with an SMTP client process. It waits for a connection to be established via the transport service. It receives SMTP commands from the SMTP client, sends replies, and performs the specified operations. reply A reply is an acknowledgment (positive or negative) sent from receiver to sender via the transmission channel in response to a command. The general form of a reply is a completion code (including error codes) followed by a text string. The codes are for use by programs and the text is usually intended for human users. SMTP client process A process which transfers mail in cooperation with an SMTP server process. A local language may be used in the user interface command/reply dialogue. The SMTP client initiates the transport service connection. It initiates SMTP commands, receives replies, and governs the transfer of mail. session The set of exchanges that occur while the transmission channel is open. transaction The set of exchanges required for one message to be transmitted for one or more recipients. transmission channel A full-duplex communication path between an SMTP client and a SMTP server for the exchange of commands, replies, and mail text. transport service Any reliable stream-oriented data communication services. For example, TCP. user A human being (or a process on behalf of a human being) wishing to obtain mail transfer service. In addition, a recipient of computer mail. word A sequence of printing characters. <CRLF> The characters carriage return and line feed (in that order). <SP> The space character. APPENDIX I: Deprecated features of RFC 821 A few features of RFC 821 have proven to be problematic and should not be used in Internet mail. These are: (1) TURN This command, described in RFC 821, raises important security issues (described in RFC 1123). Its use is deprecated; SMTP systems SHOULD NOT use it unless the server can authenticate the client. (2) Source routing RFC 821 utilized the concept of explicit source routing to get mail from one host to another via a series of relays. The requirement to utilize source routes in regular mail traffic was eliminated by the introduction of the domain name system "MX" record and the last significant justification for them was eliminated by the introduction, in RFC 1123, of a clear requirement that addresses following an "@" must all be fully-qualified domain names. Consequently, the only remaining justifications for the use of source routes are support for very old SMTP clients or MUAs and in mail system debugging. They can, however, still be useful in the latter circumstance and for routing mail around serious, but temporary, problems such as problems with the relevant DNS records. SMTP servers MUST continue to accept source route syntax as specified in the main body of this document and in RFC 1123. They MAY, if necessary, ignore the routes and utilize only the target domain in the address. If they do utilize the source route, the message MUST be sent to the first domain shown in the address. In particular, a server MUST NOT guess at shortcuts within the source route. Clients SHOULD NOT utilize explicit source routing except under unusual circumstances, such as debugging or potentially relaying around firewall or mail system configuration errors. (3) HELO As discussed in sections ##3.1 and ##4.1.1, EHLO is strongly preferred to HELO when the server will accept the former. Servers must continue to accept HELO in order to support older clients. (4) #-literals RFC 821 provided for specifying an Internet address as a decimal integer host number prefixed by a pound sign, "#". In practice, that form has been obsolete since the introduction of TCP/IP. It is deprecated and MUST NOT be used. (5) Dates and years When dates are inserted into messages by SMTP clients or servers (e.g., in trace fields), four-digit years MUST BE used. Two-digit years are deprecated; three-digit years were never permitted in the Internet mail system. (6) Sending versus mailing In addition to specifying a mechanism for delivering messages to user's mailboxes, RFC 821 provided additional, optional, commands to deliver messages directly to the user's terminal screen. These commands (SEND, SAML, SOML) were rarely implemented, and changes in workstation technology and the introduction of other protocols may have rendered them obsolete even where they are implemented. Clients SHOULD NOT provide SEND, SAML, or SOML as services. Servers MAY implement them. If they are implemented by servers, the implementation model specified in RFC 821 MUST be used and the command names MUST be published in the response to the EHLO command. APPENDIX X: Change summary and Loose ends (temporary) X.1 Change summary X.1.1 Substantive changes between draft-ietf-drums-smtpupd-00.txt and draft-ietf-drums-smtpupd-01.txt (i) Slightly clarified the discussions of rejection and failure of VRFY requests and the associated response codes. (ii) Slightly clarified the discussion of deferred address validation. (iii) Removed the IPCE terminology and modified the text in section ##4.1.1.2 to explicitly introduce the "mail gateway" terminology and to begin to distinguish a mail gateway from a conventional relay. **Please Review This Text**. (iv) Explicitly noted that SMTP clients for things like POP and IMAP may send everything to a single relay for further processing, rather than resolving final domain names. (v) Tightened the RSET discussion. (vi) Deprecation of 251 only for RCPT (still ok for VRFY) X.1.2. Substantive changes between draft-ietf-drums-smtpupd-01.txt and draft-ietf-drums-smtpupd-02.txt. Incorporated additional RFC 1123 material; reorganized several sections for clarity. Added definitions and other previous "loose end" material. X.1.3. Substantive changes between draft-ietf-drums-smtpupd-02.txt and draft-ietf-drums-smtpupd-03.txt. (i) Eliminated a number of placeholders and tightened some of the definitions in section 2. Added a few new placeholders for consistency checking against other documents. (ii) Removed the state diagrams, per direction at IETF Montreal. (iii) Added new section 6.3, an attempt to summarize WG discussions on the "posting" versus "delivery" versus "relay" functions of SMTP and on whether "fixups" are appropriate in different cases. (iv) Inserted section 6.1, a minor rewrite of section 5.3.3 of RFC1123. (v) Added new text to 3.5.5 to discuss the spammer - EXPN relationship. (vi) The "ASCII requirement" in 4.1.1.4 has been tightened somewhat. (v) The remaining miscellaneous changes agreed to in Montreal have been incorporated except as noted below. X.2 Loose ends (i) Material in RFC1123, section 5.2.6, not yet fully incorporated. (ii) Is 5.3.4 of RFC1123 adequately incorporated? (iii) What needs to be done about RFC1123 5.3.6 and 5.3.7 and where should it/they go? (iv) The 822 BNF -> ABNF transition is not yet complete, and most of what has been done needs checking. (v) Example not yet revised, overview and grammer still to be merged. See also Chris Newman's "Drums open issues" list.