home *** CD-ROM | disk | FTP | other *** search
/ Magazyn WWW 1998 October / www_10_1998.iso / info / ogonki / ietfdrum.txt < prev    next >
Text File  |  1998-09-09  |  127KB  |  3,365 lines

  1. INTERNET-DRAFT                                     John Klensin, Editor
  2. Expires in six months                                               MCI
  3.                                                       November 22, 1995
  4.  
  5.                   Simple Mail Transfer Protocol 
  6.  
  7.          draft-ietf-drums-smtpupd-01.txt
  8.  
  9.                      Status of this Memo
  10.  
  11. This document is an Internet-Draft.  Internet-Drafts are working
  12. documents of the Internet Engineering Task Force (IETF), its areas, and
  13. its working groups. Note that other groups may also distribute working
  14. documents as Internet-Drafts.
  15.  
  16. Internet-Drafts are draft documents valid for a maximum of six months.
  17. Internet-Drafts may be updated, replaced, or obsoleted by other
  18. documents at any time.  It is not appropriate to use Internet-Drafts as
  19. reference material or to cite them other than as a "working draft" or
  20. "work in progress".
  21.  
  22. To learn the current status of any Internet-Draft, please check the
  23. 1id-abstracts.txt listing contained in the Internet-Drafts Shadow
  24. Directories on ds.internic.net (US East Coast), nic.nordu.net (Europe),
  25. ftp.isi.edu (US West Coast), or munnari.oz.au (Pacific Rim).
  26.  
  27. If consensus is reached on this document, it will be forwarded to the
  28. IESG with the recommendation that it be processed as a Proposed
  29. Standard for mail transport.
  30.  
  31. [[ Note in Draft: this version of the I-D is very much a work in
  32. progress.  It should be read by the WG as a proposal about what
  33. material should go into the draft and how it should be structured.  The
  34. editor is painfully aware that there are almost certainly still
  35. inconsistencies in section numbering and the like.  More important,
  36. neither is the balance and allocation of material between the "model",
  37. "procedures", and "specifications" sections yet right, nor is the
  38. attempt to consolidate the syntax and semantics sections to make it
  39. easier to find things fully satisfactory.
  40.  
  41. I have also not yet reworked the examples or state diagrams: For
  42. example, I believe that all of the ".ARPA" domains should be pulled out
  43. and replaced with contemporary examples, that all "HELO" examples
  44. should be replaced by "EHLO" ones, and that all free-text mailed error
  45. replies should be replaced by NOTARY-format messages.  The rewrite to
  46. use 822-ish ABNF is not complete and this draft contains an odd mix as
  47. a result -- I'd appreciate help with that from someone who has the time
  48. and patience.  This effort has, incidentally, further convinced me that
  49. we should create a completely separate RFC that defines the ABNF,
  50. rather than having everything refer to the not-completely-satifactory
  51. definition in 822.  WG input on those issues is critical.  The WG
  52. should also decide how much of the explanatory and justification
  53. material (e.g., from 1123) should be included: this draft is very
  54. inconsistent along that dimension.    And, of course, the WG should
  55. discuss what is in here that shouldn't be and what should be in here
  56. that the incompetent editor has forgotten.
  57.  
  58. Sections marked with doubled brackets (e.g., "<<") are explicit
  59. placeholders or known major loose ends.]]
  60.  
  61.  
  62.  
  63.                            TABLE OF CONTENTS
  64.    0.  ABSTRACT
  65.  
  66.    1.  INTRODUCTION
  67.  
  68.    2.  THE SMTP MODEL
  69.  
  70.       2.1 Basic structure
  71.       2.2 The extension model
  72.       2.3 Other terminology
  73.  
  74.    3.  THE SMTP PROCEDURES: AN OVERVIEW
  75.  
  76.       3.1   Session Initiation
  77.       3.2   Client initiation
  78.       3.3.  Mail
  79.       3.4.  Forwarding for Address Correction or Updating
  80.       3.5.  Verifying and Expanding
  81.       3.6.  Sending and Mailing
  82.       3.7.  Domains 
  83.       3.8.  Relaying
  84.       3.9.  Changing Roles
  85.       3.10. Terminating sessions and connections
  86.  
  87.    4.  THE SMTP SPECIFICATIONS
  88.  
  89.       4.1.  SMTP Commands
  90.       4.1.1.  Command Semantics and Syntax
  91.       4.1.2.  Lower-level Syntax 
  92.       4.1.3   Order of commands
  93.       4.1.4   Private-use commands
  94.       4.2.  SMTP Replies
  95.       4.2.1.  Reply Codes by Function Group
  96.       4.2.2.  Reply Codes in Numeric Order 
  97.       4.2.3.  Reply code 502
  98.       4.2.4  Reply codes after DATA and the subsequent CRLF.CRLF.
  99.       4.3.  Sequencing of Commands and Replies
  100.       4.4   Trace information
  101.       4.5.  State Diagrams
  102.       4.6.  Details
  103.       4.6.1.  Minimum Implementation
  104.       4.6.2.  Transparency
  105.       4.6.3.  Sizes and Timeouts
  106.       4.6.4   Queuing Strategies
  107.  
  108.    5. Problem detection and handling
  109.       5.1 Replies by email
  110.       5.2 Loop detection
  111.  
  112.    6. Security Considerations
  113.  
  114.    7. References
  115.  
  116.    8. Editor's addresses
  117.  
  118.    9. Acknowledgements
  119.  
  120.    APPENDIX A:  TCP
  121.    APPENDIX B:  Generating SMTP commands from RFC 822 headers
  122.    APPENDIX E:  Theory of Reply Codes
  123.    APPENDIX F:  Scenarios
  124.    APPENDIX G:  Other gateway issues.
  125.    APPENDIX H:  Glossary
  126.    APPENDIX X:  Change summary and Loose ends (temporary)
  127.  
  128.  
  129.  
  130.  
  131. 0.  Abstract
  132.  
  133. This document is a self-contained specification of the basic protocol
  134. for the Internet electronic mail transport, consolodating and
  135. updating 
  136.  
  137.  * the original SMTP specification of RFC 821 [RFC-821],
  138.  * Domain name system requirements and implications for mail
  139.    transport from RFC 1035 [RFC-DNS] and RFC 974 [RFC974],
  140.  * the clarifications and applicability statements in 
  141.      RFC 1123 [RFC-1123], and
  142.  * material drawn from the SMTP Extension mechanisms [SMTPEXT].
  143.  
  144. It is intended to replace RFC 821, RFC 974, and the mail transport
  145. materials of RFC 1123.  However, RFC 821 specifies some features that
  146. are not in significant use in the Internet of the mid-1990s and, in
  147. appendices, some additional transport models.  Those sections are
  148. omitted in this document in the interest of clarity and brevity;
  149. readers needing them should refer to RFC 821. 
  150.  
  151. It also includes some additional material from RFC 1123 that appeared
  152. to need amplification.  These have been identified in multiple ways,
  153. mostly by tracking flaming on the header-people list [HEADER-PEOPLE]
  154. and problems of unusual readings or interpretations that have turned
  155. up as the SMTP extensions have been deployed.  It is important to
  156. note that everything here is in response to some identified confusion
  157. or bad behavior, not just paranoia. 
  158.  
  159. Where this specification moves beyond consolodation and actually
  160. differs from earlier documents, it supersedes them technically as
  161. well as textually.
  162.  
  163. Although SMTP was designed as a mail transport and delivery protocol,
  164. this specification also contains information that is important to its
  165. use as a "mail posting" protocol, as recommended for POP [RFC-POP2,
  166. RFC-POP3] and IMAP [RFC-IMAP4].
  167.  
  168. Except when the historical terminology is necessary for clarity, this
  169. document uses the current "client" and "server" terminology to
  170. identify the sending and receiving SMTP processes, respectively. 
  171.  
  172. A companion document discusses mail bodies and formats: RFC 822,
  173. MIME, and their relationship. 
  174.  
  175. 1.  INTRODUCTION
  176.  
  177. The objective of the Simple Mail Transfer Protocol (SMTP) is to
  178. transfer mail reliably and efficiently.
  179.  
  180. SMTP is independent of the particular transmission subsystem and
  181. requires only a reliable ordered data stream channel.  While this
  182. document specifically discusses transport over TCP, other
  183. transports are possible.  Appendices to RFC 821 describe some of
  184. them. A Glossary provides the definitions of terms as used in this
  185. document.
  186.  
  187. An important feature of SMTP is its capability to transport mail
  188. across transport service environments, usually referred to as "mail
  189. gatewaying".  A transport service environment might consist of the
  190. mutually-TCP-accessible hosts on the public internet, a
  191. firewall-isolated private TCP/IP LAN, or a LAN or WAN environment
  192. utilizing an entirely different transport-level protocol.  It is
  193. important to realize that transport systems are not one-to-one with
  194. usual definitions of "networks".  A process can communicate directly
  195. with another process, and mail communicated, through any mutually
  196. known transport layer.  Conversely, mail can be relayed (actually
  197. gatewayed) between hosts on different transport systems by a host on
  198. both transport systems.  The Mail eXchanger mechanisms of the domain
  199. name system [RFC-DNS, RFC974] usually permit relaying and gatewaying
  200. to occur invisibly to the user.
  201.  
  202.  
  203. 2.  THE SMTP MODEL
  204.  
  205. 2.1 Basic structure
  206.  
  207. The SMTP design is based on the following model of communication: as
  208. the result of a user mail request (or transfer from a mail user agent
  209. (see section 2.3), the SMTP client establishes a two-way transmission
  210. channel to an SMTP server.  Fully-capable client SMTPs determine the
  211. host address supporting the server SMTP function by resolving the
  212. domain name in the user request to it into either an intermediate
  213. mail exchanger host or a final target host.  In other cases, common
  214. with clients associated with implementations of the POP [RFC-POP2,
  215. RFC-POP3] or IMAP [RFC-IMAP4] protocols, or when the client is inside
  216. an isolated transport service enviroment, the SMTP client may send all
  217. of its traffic to a single SMTP server which, in turn, relays the
  218. mail to final (or other intermediate) destinations and which supports
  219. all of the queuing, retrying, and alternate address functions
  220. discussed in this specification. The SMTP server may be either the
  221. ultimate destination or an intermediate (i.e., may assume the role of
  222. an SMTP client after receiving the message).  SMTP commands are
  223. generated by the SMTP client and sent to the SMTP server.  SMTP
  224. replies are sent from the SMTP server to the SMTP client in response
  225. to the commands. 
  226.  
  227. Once the transmission channel is established and initial handshaking
  228. completed, the SMTP-sender sends a MAIL command indicating the sender
  229. of the mail.  If the server SMTP can accept mail it responds with an
  230. OK reply.  The client SMTP then sends a RCPT command identifying a
  231. recipient of the mail.  If the server SMTP can accept mail for that
  232. recipient (or believes that it can but cannot immediately verify that
  233. fact--see below) it responds with an OK reply; if not, it responds
  234. with a reply rejecting that recipient (but not the whole mail
  235. transaction).  The client and server SMTPs may negotiate several
  236. recipients.  When the recipients have been negotiated the client
  237. sends the mail data, terminating with a special sequence.  If the
  238. server successfully processes the mail data it responds with an OK
  239. reply.  Either the sender or recipient commands may include
  240. server-permitted SMTP service extension requests as discussed in
  241. section 2.2.  The dialog is purposely lock-step, one-at-a-time
  242. although this can be modified by mutually-agreed extension requests.
  243.  
  244.      -------------------------------------------------------------
  245.  
  246.    
  247.                +----------+                +----------+
  248.    +------+    |          |                |          |
  249.    | User |<-->|          |      SMTP      |          |
  250.    +------+    |  Sender- |Commands/Replies| Receiver-|
  251.    +------+    |   SMTP   |<-------------->|    SMTP  |    +------+
  252.    | File |<-->|          |    and Mail    |          |<-->| File |
  253.    |System|    |          |                |          |    |System|
  254.    +------+    +----------+                +----------+    +------+
  255.    
  256.  
  257.                 SMTP client                SMTP server
  258.  
  259.                            Model for SMTP Use
  260.  
  261.                                 Figure 1
  262.  
  263.      -------------------------------------------------------------
  264.  
  265. An SMTP server may "accept mail" for a recipient under one of two
  266. circumstances: when it can actually verify the address or when it can
  267. make a determination that it is willing to accept responsibility for
  268. the mail.  Replies to the RCPT command MUST NOT be delayed beyond a
  269. reasonable time in order to verify addresses.  Hence, a "250 OK"
  270. reply to a RCPT command does not necessarily imply that the delivery
  271. address(es) are valid.  Errors found after message acceptance will be
  272. reported by mailing a notification message to an appropriate address.
  273.  
  274.  
  275. DISCUSSION:
  276.  
  277.      The set of conditions under which a RCPT parameter can be
  278.      validated immediately is an engineering design choice.
  279.      Reporting destination mailbox errors to the Sender-SMTP
  280.      before mail is transferred is generally desirable to save
  281.      time and network bandwidth, but this advantage is lost if
  282.      RCPT verification is lengthy.
  283.  
  284.      For example, most SMTP servers can immediately verify any
  285.      simple local reference, such as a single locally-
  286.      registered mailbox.  On the other hand, the "reasonable
  287.      time" limitation generally implies deferring verification
  288.      of a mailing list until after the message has been
  289.      transferred and accepted, since verifying a large mailing
  290.      list can take a very long time.  An implementation might
  291.      or might not choose to defer validation of addresses that
  292.      are non-local and therefore require a DNS lookup.  If a
  293.      DNS lookup is performed but a soft domain system error
  294.      (e.g., timeout) occurs, validity must be assumed.  An SMTP
  295.      relay would usually defer verification of addresses when
  296.      service extensions are specified that require verification
  297.      with the destination host.
  298.  
  299.  
  300. The SMTP provides mechanisms for the transmission of mail; directly
  301. from the sending user's host to the receiving user's host when the
  302. two hosts are connected to the same transport service, via one or
  303. more relay SMTP-servers when the source and destination hosts are not
  304. connected to the same transport service, or when an intermediate
  305. host is selected via a Mail eXchanger mechanism.
  306.  
  307. To be able to provide the relay capability the server SMTP is
  308. supplied with the name of the ultimate destination host as well as
  309. the destination mailbox name.  Usually, intermediate hosts are
  310. determined via the DNS MX record, not by explicit "source" routing.
  311.  
  312. The argument to the MAIL command is normally an address in
  313. mailbox@domain format, which specifies who the mail is from.  The
  314. argument to the RCPT command is normally also an address, which
  315. specifies who the mail is to.  More generally, the MAIL address is
  316. a forward-path and the RCPT address a reverse-path.  The
  317. forward-path is a source route, while the reverse-path is a return 
  318. route (which may be used to return a message to the sender when an
  319. error occurs with a relayed message).
  320.  
  321. When the same message is sent to multiple recipients the SMTP
  322. encourages the transmission of only one copy of the data for all the
  323. recipients at the same destination host.
  324.  
  325. The mail commands and replies have a rigid syntax.  Replies also have
  326. a numeric code.  In the following, examples appear which use actual
  327. commands and replies.  The complete lists of commands and replies
  328. appears in Section 4 on specifications.
  329.  
  330. Commands and replies are not case sensitive.  That is, a command or
  331. reply word MAY be upper case, lower case, or any mixture of upper and
  332. lower case.  Note that this is not true of mailbox user names.  For
  333. some hosts the user name is case sensitive (this practice impedes
  334. interoperability and is discouraged), and SMTP implementations
  335. MUST take care to preserve the case of user names as they appear in
  336. mailbox arguments.  Domain names are not case sensitive.
  337.  
  338. Commands and replies are composed of characters from the ASCII
  339. character set [1].  When the transport service provides an 8-bit byte
  340. (octet) transmission channel, each 7-bit character is transmitted
  341. right justified in an octet with the high order bit cleared to zero.
  342. More specifically, the unextended SMTP service provides seven bit
  343. transport only.  SMTP clients MUST NOT transmit messages with
  344. information in the high-order bit of octets.   If such messages
  345. are transmitted in violation of this rule, receiving SMTP servers
  346. MAY clear the high-order bit or reject the message as invalid.
  347. Eight -bit transmission MAY be requested of the server by the
  348. client using extended SMTP facilities. 
  349.  
  350. When specifying the general form of a command or reply, an argument
  351. (or special symbol) will be denoted by a meta-linguistic variable (or
  352. constant), for example, "<string>" or "<reverse-path>".  Here the
  353. angle brackets indicate these are meta-linguistic variables.
  354. However, some arguments use the angle brackets literally.  For
  355. example, an actual reverse-path is enclosed in angle brackets, i.e.,
  356. "<John.Smith@ISI.EDU>" is an instance of <reverse-path> (the
  357. angle brackets are actually transmitted in the command or reply).
  358.  
  359.  
  360. 2.2 The Extension Model
  361.  
  362. 2.2.1 Background
  363.  
  364. In an effort that started in 199??, approximately a decade after
  365. RFC 821 was completed, the protocol was modified with a "service
  366. extensions" model that permits the client and server to agree to
  367. utilize shared functionality that goes beyond the original basic
  368. SMTP requirements.  SMTP implementations SHOULD support the basic
  369. extension mechanisms (see below for details), i.e., servers
  370. should support the EHLO command even if they do not implement any
  371. specific extensions and clients SHOULD preferentially utilize EHLO
  372. rather than HELO.  However, for compatibility with older
  373. implementations, SMTP clients and servers MUST support the
  374. original HELO mechanisms.
  375.  
  376. Although SMTP is widely and robustly deployed, some parts of the
  377. Internet community might wish to extend the SMTP service.  The SMTP
  378. extension mechanism defines a means whereby an extended SMTP client
  379. and server may recognize each other as such and the server can inform
  380. the client as to the service extensions that it supports.
  381.  
  382. It must be emphasized that any extension to the SMTP service should
  383. not be considered lightly. SMTP's strength comes primarily from its
  384. simplicity.  Experience with many protocols has shown that:
  385.  
  386.      protocols with few options tend towards ubiquity, whilst
  387.      protocols with many options tend towards obscurity.
  388.  
  389. This means that each and every extension, regardless of its benefits,
  390. must be carefully scrutinized with respect to its implementation,
  391. deployment, and interoperability costs. In many cases, the cost of
  392. extending the SMTP service will likely outweigh the benefit.
  393.  
  394. Given this environment, the extension framework consists of:
  395.  
  396.  (1)   The SMTP command EHLO, superseding the earlier HELO,
  397.  
  398.  (2)   a registry of SMTP service extensions, and
  399.  
  400.  (3)   additional parameters to the SMTP MAIL FROM and RCPT TO
  401.        commands.
  402.  
  403.  
  404. 2.2.2 Definition and Registration of Extensions
  405.  
  406. The IANA maintains a registry of SMTP service extensions.
  407. Associated with each such extension is a corresponding EHLO
  408. keyword value. Each service extension registered with the IANA
  409. must be defined in an RFC. Such RFCs must either be on the
  410. standards-track or must define an IESG-approved experimental
  411. protocol.  The definition must include:
  412.  
  413.  (1)   the textual name of the SMTP service extension;
  414.  
  415.  (2)   the EHLO keyword value associated with the extension;
  416.  
  417.  (3)   the syntax and possible values of parameters associated
  418.        with the EHLO keyword value;
  419.  
  420.  (4)   any additional SMTP verbs associated with the extension
  421.        (additional verbs will usually be, but are not required
  422.        to be, the same as the EHLO keyword value);
  423.  
  424.  (5)   any new parameters the extension associates with the
  425.        MAIL FROM or RCPT TO verbs;
  426.  
  427.  (6)   how support for the extension affects the behavior of a
  428.        server and client SMTP; and,
  429.  
  430.  (7)   the increment by which the extension is increasing the
  431.        maximum length of the commands MAIL FROM, RCPT TO, or
  432.        both, over that specified in RFC 821.
  433.  
  434. In addition, any EHLO keyword value that starts with an upper
  435. or lower case "X" refers to a local SMTP service extension,
  436. which is used through bilateral, rather than standardized,
  437. agreement. Keywords beginning with "X" may not be used in a
  438. registered service extension.
  439.  
  440. Any keyword values presented in the EHLO response that do not
  441. begin with "X" must correspond to a standard, standards-track,
  442. or IESG-approved experimental SMTP service extension
  443. registered with IANA.  A conforming server must not offer non
  444. "X" prefixed keyword values that are not described in a
  445. registered extension.
  446.  
  447. Additional verbs are bound by the same rules as EHLO keywords;
  448. specifically, verbs begining with "X" are local extensions
  449. that may not be registered or standardized and verbs not
  450. beginning with "X" must always be registered.
  451.  
  452.  
  453. 2.3 Terminology
  454.  
  455. A glossary of terms appears at the end of this document.  However,
  456. the following terms and concepts are used in special ways here, or
  457. represent differences in terminology between RFC 821 and this
  458. document and should be understood before reading further.
  459.  
  460. SMTP relays a mail object containing an envelope and a content.
  461.  
  462.  (1)   The SMTP envelope is straightforward, and is sent as a
  463.        series of SMTP protocol units (described in section 3): it
  464.        consists of an originator address (to which error reports
  465.        should be directed); a delivery mode (e.g., deliver to
  466.        recipient mailboxes); and, one or more recipient addresses.
  467.  
  468.  (2)   The SMTP content is sent in the SMTP DATA protocol unit
  469.        and has two parts: the headers and the body. The
  470.        headers form a collection of field/value pairs
  471.        structured according to RFC 822 [RFC822], whilst the body,
  472.        if structured, is defined according to MIME [3]. The
  473.        content is textual in nature, expressed using the US
  474.        ASCII repertoire (ANSI X3.4-1986). Although extensions
  475.        (such as MIME) may relax this restriction for the
  476.        content body, the content headers are always encoded
  477.        using the US ASCII repertoire. The algorithm defined in
  478.        [4] is used to represent header values outside the US
  479.        ASCII repertoire, whilst still encoding them using the
  480.        US ASCII repertoire.
  481.  
  482. <<placeholders>>
  483.  
  484. SMTP-sender, SMTP-receiver -> client and server
  485. UA
  486. MTA
  487. host
  488. domain
  489. buffer
  490. state table  
  491.  
  492. 2.4 Syntax Principles
  493.  
  494. The commands consist of a command code followed by an argument field.
  495. Command codes are four alphabetic characters.  Upper and lower case
  496. alphabetic characters are to be treated identically.  Thus, any of
  497. the following may represent the mail command:
  498.  
  499.    MAIL    Mail    mail    MaIl    mAIl
  500.  
  501. This also applies to any symbols representing parameter values, such
  502. as "TO" or "to" for the forward-path.  Command codes and the argument
  503. fields are separated by one or more spaces.  However, within the
  504. reverse-path and forward-path arguments case is important.  In
  505. particular, in some hosts the user "smith" is different from the user
  506. "Smith".
  507.  
  508. The argument field consists of a variable length character string
  509. ending with the character sequence <CRLF>.  The receiver is to take
  510. no action until this sequence is received.
  511.  
  512. The syntax for each command is shown with the discussion of that
  513. command, with common elements and parameters shown in section
  514. <<>>??.??. 
  515.  
  516. Square brackets denote an optional argument field.  If the option is
  517. not taken, the appropriate default is implied.
  518.  
  519. <<>> Reference 822 ABNF.
  520.  
  521.  
  522. 3.  THE SMTP PROCEDURES: AN OVERVIEW
  523.  
  524. This section presents the procedures used in SMTP in several parts.
  525. First comes the basic mail procedure defined as a mail transaction.
  526. Following this are descriptions of forwarding mail, verifying mailbox
  527. names and expanding mailing lists, sending to terminals instead of or
  528. in combination with mailboxes, and the opening and closing exchanges.
  529. At the end of this section are comments on relaying, a note on mail
  530. domains, and a discussion of changing roles.  Throughout this section
  531. are examples of partial command and reply sequences, several complete
  532. scenarios are presented in Appendix F.
  533.  
  534. 3.1 Session initiation: EHLO
  535.  
  536. An SMTP session is initiated by the client opening a connection to
  537. the server and the server responding with an opening message.
  538.  
  539. SMTP server implementations SHOULD include identification of their
  540. software and version information in the connection greeting reply
  541. after the 220 code. This practice permits much more efficient
  542. isolation and repair of any problems.  While some systems also
  543. identify their contact point for mail problems, this is not a
  544. substitute for maintaining the required Postmaster address (see
  545. [RFC822]).  Implementations MAY make provision for SMTP servers to be
  546. configured to disable the software and version announcement where it
  547. causes security concerns.
  548.  
  549. 3.2 Client initiation: EHLO
  550.  
  551. The client then sends the EHLO command to the server, indicating its
  552. identity.  In addition to opening the session, use of EHLO indicates
  553. that the client is able to process service extensions and requests
  554. that the server provide a list of the extensions it supports.  Older
  555. SMTP systems, unable to support service extensions, MAY use HELO
  556. instead of EHLO but EHLO SHOULD be used by all current clients and
  557. accepted by all current systems.
  558.  
  559. In the EHLO, or the older HELO, command the host sending the command
  560. identifies itself; the command may be interpreted as saying "Hello, I
  561. am <domain>" (and, in the case of EHLO, "and I support service
  562. extension requests").
  563.  
  564.    -------------------------------------------------------------
  565.  
  566.           Example of Connection Opening
  567.  
  568.       R: 220 BBN-UNIX.ARPA Simple Mail Transfer Service Ready
  569.       S: HELO USC-ISIF.ARPA
  570.       R: 250 BBN-UNIX.ARPA
  571.  
  572.                 Example 5
  573.  
  574.    -------------------------------------------------------------
  575.  
  576.    -------------------------------------------------------------
  577.  
  578.           Example of Connection Closing
  579.  
  580.       S: QUIT
  581.       R: 221 BBN-UNIX.ARPA Service closing transmission channel
  582.  
  583.                 Example 6
  584.  
  585.    -------------------------------------------------------------
  586.  
  587.  
  588. 3.3.  MAIL
  589.  
  590. There are three steps to SMTP mail transactions.  The transaction
  591. is started with a MAIL command which gives the sender
  592. identification.  A series of one or more RCPT commands follows
  593. giving the receiver information.  Then a DATA command gives the
  594. mail data.  And finally, the end of mail data indicator confirms
  595. the transaction.
  596.  
  597.    The first step in the procedure is the MAIL command.  The
  598.    <reverse-path> contains the source mailbox.
  599.  
  600.       MAIL <SP> FROM:<reverse-path> [<SP> <mail-parameters>] <CRLF>
  601.  
  602.    This command tells the SMTP-receiver that a new mail
  603.    transaction is starting and to reset all its state tables and
  604.    buffers, including any recipients or mail data.  It gives the
  605.    reverse-path which can be used to report errors (see section
  606.    4.2 for a discussion of error reporting).  If accepted, the
  607.    SMTP server returns a 250 OK reply. 
  608.  
  609.    The <reverse-path> can contain more than just a mailbox.  The
  610.    <reverse-path> is a reverse source routing list of hosts and
  611.    source mailbox.  The first host in the <reverse-path> should be
  612.    the host sending this command.
  613.  
  614.    The optional <mail-parameters> are associated with negotiated SMTP
  615.    service extensions (see section 2.2).
  616.  
  617.    The second step in the procedure is the RCPT command.
  618.  
  619.       RCPT <SP> TO:<forward-path> [<SP> <rcpt-parameters>] <CRLF>
  620.  
  621.    This command gives a forward-path identifying one recipient.
  622.    If accepted, the SMTP server returns a 250 OK reply, and
  623.    stores the forward-path.  If the recipient is unknown the
  624.    SMTP server returns a 550 Failure reply (other circumstances
  625.    and reply codes are possible).  This second step of the procedure
  626.    can be repeated any number of times.  The <forward-path> can
  627.    contain more than just a mailbox.  The <forward-path> may be a
  628.    source routing list of hosts and the destination mailbox.
  629.    However, in general, the <forward-path> should contain only a
  630.    mailbox and domain name, relying on the domain name system to
  631.    supply routing information if required.  Servers MUST be prepared
  632.    to encounter a list of source routes in the forward path, but MAY
  633.    ignore the routes or decline to support the relaying they imply.
  634.    Similarly, servers MAY decline to accept mail that is destined for
  635.    other hosts or systems.  Of course, such a restrictions would make
  636.    a server useless as a relay for clients that do not support full
  637.    SMTP functionality, but such clients MUST NOT assume that any SMTP
  638.    server on the Internet can be used as their mail processing site.  
  639.  
  640.    Clients SHOULD NOT utilize explicit source routing except under
  641.    unusual circumstances, such as debugging or potentially relaying
  642.    around firewalls or mail system configuration errors.   If
  643.    source routes are used, the first host in the <forward-path>
  644.    should be the host receiving this command.
  645.  
  646.    The optional <mail-parameters> are associated with negotiated SMTP
  647.    service extensions (see section 2.2).
  648.  
  649.    The third step in the procedure is the DATA command.
  650.  
  651.       DATA <CRLF>
  652.  
  653.    If accepted, the SMTP server returns a 354 Intermediate reply
  654.    and considers all succeeding lines to be the message text.
  655.    When the end of text is received and stored the SMTP-receiver
  656.    sends a 250 OK reply.
  657.  
  658.    Since the mail data is sent on the transmission channel the end
  659.    of the mail data must be indicated so that the command and
  660.    reply dialog can be resumed.  SMTP indicates the end of the
  661.    mail data by sending a line containing only "." (period or
  662.    full stop).  A transparency procedure is used to prevent
  663.    this from interfering with the user's text (see Section 4.5.2).
  664.  
  665.    The end of mail data indicator also confirms the mail
  666.    transaction and tells the SMTP server to now process the
  667.    stored recipients and mail data.  If accepted, the
  668.    SMTP server returns a 250 OK reply.  The DATA command should
  669.    fail only if the mail transaction was incomplete (for example,
  670.    no recipients), or if resources are not available.  However,
  671.    some servers in practice do not perform recipient
  672.    verification until after the message text is received.
  673.    These servers SHOULD treat a failure for one or more
  674.    recipients as a "subsequent failure" and return a mail
  675.    message as discussed in section <<>>.   Using a "recipient
  676.    not found" or equivalent reply code after the data are
  677.    accepted makes it difficult or impossible for the client to
  678.    determine which recipients failed.
  679.  
  680. The above procedure is an example of a mail transaction.  These
  681. commands must be used only in the order discussed above.
  682. Example 1 (below) illustrates the use of these commands in a mail
  683. transaction.
  684.  
  685.  
  686.       -------------------------------------------------------------
  687.  
  688.                      Example of the SMTP Procedure
  689.  
  690.          This SMTP example shows mail sent by Smith at host Alpha.ARPA,
  691.          to Jones, Green, and Brown at host Beta.ARPA.  Here we assume
  692.          that host Alpha contacts host Beta directly.
  693.  
  694.             S: MAIL FROM:<Smith@Alpha.ARPA>
  695.             R: 250 OK
  696.  
  697.             S: RCPT TO:<Jones@Beta.ARPA>
  698.             R: 250 OK
  699.  
  700.             S: RCPT TO:<Green@Beta.ARPA>
  701.             R: 550 No such user here
  702.  
  703.             S: RCPT TO:<Brown@Beta.ARPA>
  704.             R: 250 OK
  705.  
  706.             S: DATA
  707.             R: 354 Start mail input; end with <CRLF>.<CRLF>
  708.             S: Blah blah blah...
  709.             S: ...etc. etc. etc.
  710.             S: <CRLF>.<CRLF>
  711.             R: 250 OK
  712.  
  713.          The mail has now been accepted for Jones and Brown.  Green did
  714.          not have a mailbox at domain Beta.ARPA.
  715.  
  716.                                Example 1
  717.  
  718.       -------------------------------------------------------------
  719.  
  720.  
  721.  
  722. 3.4.  FORWARDING FOR ADDRESS CORRECTION OR UPDATING
  723.  
  724. The "forwarding" mechanisms described in section 3.2 of RFC 821, and
  725. especially the 251 reply code from RCPT that indicates a corrected
  726. destination, are no longer in active use.  Forwarding support is most
  727. often required to consolodate and simplify addresses within, or
  728. relative to, some enterprise.  In most of those cases, information
  729. hiding (and sometimes security) considerations argue against exposure
  730. of the "final" address through the SMTP protocol as a consequence of
  731. the forwarding activity and, in some cases, that final address may
  732. not even be reachable by the sender.
  733.  
  734. Silent forwarding of messages (without server notification to the
  735. sender) is common in the contemporary Internet.
  736.  
  737. If the forwarding and address correction mechanisms described in
  738. RFC 821 are used, the addresses given should be stable enough that
  739. it would be reasonable for the client to update local records with
  740. them.
  741.  
  742.  
  743. 3.5.  VERIFYING AND EXPANDING
  744.  
  745. 3.5.1 Overview
  746.  
  747. SMTP provides, as additional features, commands to verify a user
  748. name or expand a mailing list.  This is done with the VRFY and
  749. EXPN commands, which have character string arguments.  For the
  750. VRFY command, the string is a user name (see below) and the
  751. response may include the full name of the user and must include
  752. the mailbox of the user,  e.g., it MUST BE in either 
  753.   User Name <mailbox@domain>
  754. or
  755.   mailbox@domain
  756. form.
  757.  
  758. Paths (explicit source routes) MUST NOT be returned by VRFY or
  759. EXPN. 
  760.  
  761. When a name that is the argument to VRFY could identify more
  762. than one mailbox, the server MAY either note the ambiguity or
  763. identify the alternatives.   In other words, either of the
  764. following are legitimate response to VRFY:
  765.  
  766.     553 User ambiguous
  767.    or
  768.     553- Ambiguous;  Possibilities are
  769.     553-Joe Smith <jsmith@somedomain>
  770.     553-Harry Smith <hsmith@somedomain>
  771.     553 Melvin Smith <dweep@somedomain>
  772.  
  773. Under normal circumstances a client receiving a 553 reply
  774. would be expected to expose the result to the user.  Use
  775. of exactly the forms given, and the "user ambiguous" or
  776. "ambiguous" keywords, will facilitate automated
  777. translation into other languages as needed.
  778.  
  779. For the EXPN command, the string identifies a mailing
  780. list, and the multiline response may include the full name of the
  781. users and must give the mailboxes on the mailing list.
  782.  
  783. "User name" is a fuzzy term and used purposely.  An 
  784. implementation of the VRFY or EXPN commands MUST include at
  785. least recognition of local mailboxes as "user names".  If a
  786. host chooses to recognize other strings as "user names" that is
  787. allowed. 
  788.  
  789. In some hosts the distinction between a mailing list and an alias
  790. for a single mailbox is a bit fuzzy, since a common data structure
  791. may hold both types of entries, and it is possible to have mailing
  792. lists of one mailbox.  If a request is made to verify a mailing
  793. list a positive response can be given if on receipt of a message
  794. so addressed it will be delivered to everyone on the list,
  795. otherwise an error should be reported (e.g., "550 That is a
  796. mailing list, not a user").  If a request is made to expand a user
  797. name a positive response can be formed by returning a list
  798. containing one name, or an error can be reported (e.g., "550 That
  799. is a user name, not a mailing list").
  800.  
  801. In the case of a multiline reply (normal for EXPN) exactly one
  802. mailbox is to be specified on each line of the reply.  The case
  803. of an ambiguous request is discussed above.
  804.  
  805. The case of verifying a user name is straightforward as shown in
  806. example 3.
  807.  
  808.  
  809.       -------------------------------------------------------------
  810.  
  811.           Example of Verifying a User Name
  812.  
  813.    Either
  814.  
  815.       S: VRFY Smith
  816.       R: 250 Fred Smith <Smith@USC-ISIF.ARPA>
  817.  
  818.    Or
  819.  
  820.       S: VRFY Smith
  821.       R: 251 User not local; will forward to <Smith@USC-ISIQ.ARPA>
  822.  
  823.    Or
  824.  
  825.       S: VRFY Jones
  826.       R: 550 String does not match anything.
  827.  
  828.    Or
  829.  
  830.       S: VRFY Jones
  831.       R: 551 User not local; please try <Jones@USC-ISIQ.ARPA>
  832.  
  833.    Or
  834.  
  835.       S: VRFY Gourzenkyinplatz
  836.       R: 553 User ambiguous.
  837.  
  838.              Example 3
  839.  
  840.       -------------------------------------------------------------
  841.  
  842.       The case of expanding a mailbox list requires a multiline reply as
  843.       shown in example 4.
  844.  
  845.       -------------------------------------------------------------
  846.  
  847.                   Example of Expanding a Mailing List
  848.  
  849.          Either
  850.  
  851.             S: EXPN Example-People
  852.             R: 250-Jon Postel <Postel@USC-ISIF.ARPA>
  853.             R: 250-Fred Fonebone <Fonebone@USC-ISIQ.ARPA>
  854.             R: 250-Sam Q. Smith <SQSmith@USC-ISIQ.ARPA>
  855.             R: 250-Quincy Smith <@USC-ISIF.ARPA:Q-Smith@ISI-VAXA.ARPA>
  856.             R: 250-<joe@foo-unix.ARPA>
  857.             R: 250 <xyz@bar-unix.ARPA>
  858.  
  859.          Or
  860.  
  861.             S: EXPN Executive-Washroom-List
  862.             R: 550 Access Denied to You.
  863.  
  864.                                Example 4
  865.  
  866.       -------------------------------------------------------------
  867.  
  868.       The character string arguments of the VRFY and EXPN commands
  869.       cannot be further restricted due to the variety of implementations
  870.       of the user name and mailbox list concepts.  On some systems it
  871.       may be appropriate for the argument of the EXPN command to be a
  872.       file name for a file containing a mailing list, but again there is
  873.       a variety of file naming conventions in the Internet.
  874.  
  875.  
  876. 3.5.2  VRFY normal response.
  877.  
  878. When normal (2yz or 551) responses are returned from a VRFY or EXPN
  879. request, the reply MUST include the mailbox name, e.g., "<foo@bar>"
  880. (where "bar" is a fully qualified domain name) must appear in the
  881. syntax.  EXPN and VRFY MUST return only valid domain addresses that
  882. are usable in SMTP RCPT commands.  Consequently, if an address
  883. implies delivery to a program or other system, the mailbox name used
  884. to reach that target should be given.
  885.  
  886. Server implementations MUST support VRFY and SHOULD support EXPN.  For
  887. security reasons, implementations MAY provide local installations a
  888. way to disable either or both of these commands through configuration
  889. options or the equivalent.  When these commands are supported, they
  890. are not required to work across relays when relaying is supported.
  891. Since they were both optional in RFC 821, they MUST, if supported, be
  892. listed in the response to EHLO if service extensions are supported.
  893.  
  894.  
  895. 3.5.3 Meaning of VRFY or EXPN success response.
  896.  
  897. A server MUST NOT return a 220 code in response to a VRFY or EXPN
  898. command unless it has actually verified the address.  In particular,
  899. a server MUST NOT return 220 if all it has done is to verify that the
  900. syntax given is valid.  In that case 502 (Command not implemented) or
  901. 500 (Syntax error, command unrecognized) SHOULD be returned (note
  902. that implementation of VRFY is required by RFC 1123 and EXPN is
  903. strongly recommended; this specification does not change that
  904. requirement and, hence, except as provided in section 3.5.5,
  905. implementations that return 500 or 502 for VRFY are not in compliance
  906. with the specification).
  907.  
  908. Especially when a server is acting as a mail exchanger for another,
  909. there may be circumstances where an address appears to be correct but
  910. cannot reasonably be verified in real time.  In that situation, reply
  911. code 252 SHOULD BE returned.  These cases parallel the discussion of
  912. RCPT verification discussed in section 2.1 although implementations
  913. generally SHOULD be more aggressive about address verification in the
  914. case of VRFY than in the case of RCPT even if a little more time is
  915. required to do so.
  916.  
  917.  
  918. 3.5.4. Semantics and applications of EXPN.
  919.  
  920. While EXPN is often very useful in debugging and understanding
  921. problems with mailing lists and multiple-target-address aliases,
  922. some systems have attempted to use source expansion of mailing
  923. lists as a means of eliminating duplicates.  The propagation of
  924. aliasing systems with mail on the Internet--both for hosts
  925. (typically with MX and CNAME DNS records) and for mailboxes
  926. (various types of local host aliases) has made it nearly
  927. impossible for these strategies to work, and mail systems SHOULD
  928. NOT attempt them.
  929.  
  930.  
  931. 3.5.5 VRFY, EXPN, and security.
  932.  
  933. As discussed above, individual sites may want to disable one or both
  934. of VRFY or EXPN for security reasons.  As a corollary to the above,
  935. implementations that permit this MUST NOT appear to have verified
  936. addresses that are not, in fact, verified.  If a site disables these
  937. commands for security reasons, the SMTP server SHOULD return a 252
  938. response, rather than a code that could be confused with successful
  939. or unsuccessful verification.
  940.  
  941. Returning a 250 reply code with the address listed in the VRFY
  942. command after having checked it for syntax only violates this
  943. rule.  Of course, an implementation that "supports" VRFY by
  944. always returning 550 whether or not the address is valid is
  945. equally not in conformance.
  946.  
  947.  
  948.  
  949. 3.6.  SENDING AND MAILING
  950.  
  951. The main purpose of SMTP is to deliver messages to user's mailboxes.
  952. A very similar service provided by some hosts is to deliver messages
  953. to user's terminals (provided the user is active on the host).  The
  954. delivery to the user's mailbox is called "mailing", the delivery to
  955. the user's terminal is called "sending".  Because in many hosts the
  956. implementation of sending is nearly identical to the implementation
  957. of mailing these two functions were combined in SMTP as specified in
  958. RFC 821.  However the sending commands were not included in the
  959. required minimum implementation (Section 4.5.1) and, indeed, have not
  960. been widely deployed.
  961.  
  962. Implementations of them, if provided, should refer to the details in
  963. RFC 821.  If one or more of the commands (SEND, SAML, SOML) are
  964. implemented, and service extensions are supported, the EHLO command
  965. response MUST list their names.
  966.  
  967.  
  968.  
  969. 3.7.  DOMAINS
  970.  
  971. Domains have become a key concept in the Internet
  972. mail system.  The use of domains changes the address space from a
  973. flat global space of simple character string host names to a
  974. hierarchically structured rooted tree of global addresses.  The
  975. host name is replaced by a domain and host designator which is a
  976. sequence of domain element strings separated by periods with the
  977. understanding that the domain elements are ordered from the most
  978. specific to the most general.
  979.  
  980. For example, "ISIF.ISI.EDU", "Fred.Cambridge.UK", and
  981. "PC7.LCS.MIT.EDU" might be domain identifiers.
  982.  
  983. Whenever domain names are used in SMTP, only resolvable,
  984. fully-qualified, domain names (FQDNs) are permitted.  In other words,
  985. names that can be resolved to MX RRs or A RRs (as discussed in
  986. section ??.??.??) are permitted, as are CNAME RRs whose targets can
  987. be resolved, in turn, to MX or A RRs.  Local nicknames or unqualified
  988. names MUST NOT be used. [[Note in draft: this represents a
  989. liberalization from the provisions of RFC 1123, section 5.2.2 -- WG
  990. please discuss.]]  There is one exception to this rule: the domain
  991. name given in the EHLO (or HELO) command MUST BE either a primary
  992. host name (a domain name that resolves to an A RR) or, if the host
  993. has no name, a domain literal in dotted-decimal notation.
  994.  
  995.  
  996.  
  997. 3.8.  RELAYING
  998.  
  999. The forward-path may be a source route of the form
  1000. "@ONE,@TWO:JOE@THREE", where ONE, TWO, and THREE MUST BE
  1001. fully-qualified domain names.  This form is used to emphasize the
  1002. distinction between an address and a route.  The mailbox is an
  1003. absolute address, and the route is information about how to get
  1004. there.  The two concepts should not be confused.
  1005.  
  1006. In general, the availability of Mail eXchanger records in the
  1007. domain name system [RFC-DNS] makes the use of explicit source
  1008. routes in the Internet mail system unnecessary.  Many historical
  1009. problems with their interpretation have made their use
  1010. undesirable.  SMTP clients SHOULD NOT generate explicit source
  1011. routes except under unusual circumstances.  SMTP servers MAY
  1012. decline to act as mail relays or to accept addresses that
  1013. specify source routes.  They are also permitted to ignore the route
  1014. information and simply send to the final destination as specified in
  1015. the route and the DNS.  However, there has been a practice, albeit
  1016. invalid, of using names that do not appear in the DNS as destination
  1017. names, with the senders counting on the intermediate hosts specified
  1018. in source routing to resolve any problems.  If source routes are
  1019. stripped, this practice will cause failures -- one of several reasons
  1020. why SMTP clients MUST NOT generate invalid source routes or depend on
  1021. serial resolution of names.
  1022.  
  1023. If source routes are not used, the process described in RFC 821 for
  1024. constructing a reverse-path from the forward-path is not applicable
  1025. and the reverse-path at the time of delivery will simply be the
  1026. address that appeared in the MAIL command.  If source routes are
  1027. used, RFC 821 should be consulted for the mechanisms for constructing
  1028. and updating the forward- and reverse-paths.
  1029.  
  1030. Using source routing the SMTP server receives mail to be relayed to
  1031. another SMTP server.  The SMTP server may accept or reject the task
  1032. of relaying the mail in the same way it accepts or rejects mail for a
  1033. local user.  The SMTP server transforms the command arguments by
  1034. moving its own identifier (its domain name or that of any domain for
  1035. which it is acting as a mail exchanger), if it appears, from the
  1036. forward-path to the beginning of the reverse-path.  The SMTP server
  1037. then becomes an SMTP client, establishes a transmission channel to
  1038. the next SMTP server in the forward-path, and sends it the mail.
  1039.  
  1040. Notice that the forward-path and reverse-path appear in the SMTP
  1041. commands and replies, but not necessarily in the message.  That is,
  1042. there is no need for these paths and especially this syntax to appear
  1043. in the "To:" , "From:", "CC:", etc. fields of the message header.
  1044. Conversely, SMTP servers MUST NOT derive message delivery information
  1045. from message header fields.
  1046.  
  1047. If an SMTP server has accepted the task of relaying the mail and
  1048. later finds that the forward-path is incorrect or that the mail
  1049. cannot be delivered for some other reason, then it MUST construct an
  1050. "undeliverable mail" notification message and send it to the
  1051. originator of the undeliverable mail (as indicated by the
  1052. reverse-path).  Formats specified for non-delivery reports by other
  1053. standards SHOULD be used if possible.
  1054.  
  1055. This notification message must be from the SMTP server at the relay
  1056. host or the host that first determines that delivery cannot be
  1057. accomplished.  Of course, SMTP servers should not send notification
  1058. messages about problems with notification messages.  One way to
  1059. prevent loops in error reporting is to specify a null reverse-path in
  1060. the MAIL command of a notification message.  When such a message is
  1061. transmitted the reverse-path SHOULD BE set to null.  A MAIL command
  1062. with a null reverse-path appears as follows:
  1063.  
  1064.    MAIL FROM:<>
  1065.  
  1066. An undeliverable mail notification message is shown in example 7.
  1067. This notification is in response to a message originated by JOE at
  1068. HOSTW and sent via HOSTX to HOSTY with instructions to relay it on
  1069. to HOSTZ.  What we see in the example is the transaction between
  1070. HOSTY and HOSTX, which is the first step in the return of the
  1071. notification message.
  1072.  
  1073.       -------------------------------------------------------------
  1074.  
  1075.             Example Undeliverable Mail Notification Message
  1076.  
  1077.          S: MAIL FROM:<>
  1078.          R: 250 ok
  1079.          S: RCPT TO:<@HOSTX.ARPA:JOE@HOSTW.ARPA>
  1080.          R: 250 ok
  1081.          S: DATA
  1082.          R: 354 send the mail data, end with .
  1083.          S: Date: 23 Oct 81 11:22:33
  1084.          S: From: SMTP@HOSTY.ARPA
  1085.          S: To: JOE@HOSTW.ARPA
  1086.          S: Subject: Mail System Problem
  1087.          S:
  1088. <<>>replace with NOTARY format <<>>
  1089.          S: .
  1090.          R: 250 ok
  1091.  
  1092.                                Example 7
  1093.  
  1094.       -------------------------------------------------------------
  1095.  
  1096.  
  1097.  
  1098.  
  1099. 3.9.  CHANGING ROLES
  1100.  
  1101. The TURN command was specified in RFC 821 as a mechanism for
  1102. reversing the roles of the client and server programs communicating
  1103. over the transmission channel.  It has proven in practice to cause a
  1104. security problem in environments in which the identity of the client
  1105. cannot be accurately verified by the server.  TURN SHOULD NOT be used
  1106. in such environments, which are the norm with SMTP.  For details of
  1107. TURN, see RFC 821.  Since TURN was optional in the original
  1108. specification, implementations that support it and also support
  1109. service extensions MUST identify TURN in the EHLO reply.
  1110.  
  1111.  
  1112. 3.10. TERMINATING SESSIONS AND CONNECTIONS
  1113.  
  1114. An SMTP connection is terminated by the client's sending a QUIT
  1115. command.  The server then responds with a positive reply code, after
  1116. which it closes the connection.
  1117.  
  1118.    An SMTP server MUST NOT intentionally close the connection
  1119.    except: 
  1120.       o After receiving a QUIT connand and responding with a 221 reply.
  1121.       o After detecting the need to shutdown the SMTP service and
  1122.         returning a 451 reply to any command.
  1123.  
  1124.    In particular, a server that closes connections in response
  1125.    to commands that are not understood is in violation of this
  1126.    specification.  Instead, servers are expected to be tolerant of
  1127.    unknown commands, issuing a 500 reply and awaiting further
  1128.    instructions from the client.
  1129.  
  1130.    An SMTP server which is forcibly shut down via external
  1131.    means SHOULD attempt to send a line containing 451 response
  1132.    code to the SMTP client before exiting.  The SMTP client will
  1133.    normally read the 451 response code after sending its next
  1134.    command.   
  1135.  
  1136.  
  1137. [[Note in draft: Keith and Ned suggest that we should invent a new
  1138. error code to be sent by the server when it shuts down the connection
  1139. because it has timed out waiting for a client command and that it
  1140. should be a 5yz code (since nothing temporary is happening).  Such a
  1141. shutdown is, of course, permitted by RFC 1123 and by good sense.  I
  1142. have not done this yet because I (and Mark) fear that introducing a
  1143. new code could create an excuse for more of the "send code and
  1144. shutdown" behavior patterns that we have been trying to eliminate.
  1145. Would a 4yz code be a way out?  Comments?]]
  1146.  
  1147.  
  1148.  
  1149. 4.  THE SMTP SPECIFICATIONS
  1150.  
  1151. 4.1.  SMTP COMMANDS
  1152.  
  1153. 4.1.1.  COMMAND SEMANTICS AND SYNTAX
  1154.  
  1155. The SMTP commands define the mail transfer or the mail system
  1156. function requested by the user.  SMTP commands are character strings
  1157. terminated by <CRLF>.  The command codes themselves are alphabetic
  1158. characters terminated by <SP> if parameters follow and <CRLF>
  1159. otherwise.  The syntax of mailboxes must conform to receiver site
  1160. conventions.  The SMTP commands are discussed below.  The SMTP
  1161. replies are discussed in Section 4.2.
  1162.  
  1163. A mail transaction involves several data objects which are
  1164. communicated as arguments to different commands.  The reverse-path is
  1165. the argument of the MAIL command, the forward-path is the argument of
  1166. the RCPT command, and the mail data is the argument of the DATA
  1167. command.  These arguments or data objects must be transmitted and
  1168. held pending the confirmation communicated by the end of mail data
  1169. indication which finalizes the transaction.  The model for this is
  1170. that distinct buffers are provided to hold the types of data objects,
  1171. that is, there is a reverse-path buffer, a forward-path buffer, and a
  1172. mail data buffer.  Specific commands cause information to be appended
  1173. to a specific buffer, or cause one or more buffers to be cleared.
  1174.  
  1175.  
  1176. 4.1.1.1  HELLO (HELO) or Extended HELLO (EHLO)
  1177.  
  1178. These commands are used to identify the SMTP client to the SMTP
  1179. server.  The argument field contains the host name of the SMTP
  1180. client.
  1181.  
  1182. The SMTP server identifies itself to the SMTP client in the
  1183. connection greeting reply, and in the response to this command.
  1184.  
  1185. A client SMTP SHOULD start an SMTP session by issuing the EHLO
  1186. command. If the SMTP server supports the SMTP service extensions it
  1187. will give a successful response, a failure response, or an error
  1188. response. If the SMTP server does not support any SMTP service
  1189. extensions it will generate an error response.  Older client SMTP
  1190. systems MAY, as discussed above, use HELO (as specified in RFC 821)
  1191. instead of EHLO.
  1192.  
  1193. These commands and an OK reply to one of them confirm that both the
  1194. SMTP client and the SMTP server are in the initial state, that is,
  1195. there is no transaction in progress and all state tables and buffers
  1196. are cleared.
  1197.  
  1198. If the server SMTP implements and is able to perform the EHLO
  1199. command, it will return code 250.  This indicates that both the
  1200. server and client SMTP are in the initial state, that is, there is no
  1201. transaction in progress and all state tables and buffers are cleared.
  1202.  
  1203. Normally, this response will be a multiline reply. Each line of the
  1204. response contains a keyword and, optionally, one or more parameters.
  1205. The syntax for a positive response, using the ABNF notation of
  1206. [RFC822], is:
  1207.  
  1208.      ehlo-ok-rsp  ::=      "250"    domain [ SP greeting ] CR LF
  1209.                     / (    "250-"   domain [ SP greeting ] CR LF
  1210.                         *( "250-"      ehlo-line           CR LF )
  1211.                            "250"    SP ehlo-line           CR LF   )
  1212.  
  1213.                   ; the usual HELO chit-chat
  1214.      greeting     ::= 1*<any character other than CR or LF>
  1215.  
  1216.      ehlo-line    ::= ehlo-keyword *( SP ehlo-param )
  1217.  
  1218.      ehlo-keyword ::= (ALPHA / DIGIT) *(ALPHA / DIGIT / "-")
  1219.  
  1220.                   ; syntax and values depend on ehlo-keyword
  1221.      ehlo-param   ::= 1*<any CHAR excluding SP and all
  1222.                          control characters (US ASCII 0-31
  1223.                          inclusive)>
  1224.  
  1225.      ALPHA        ::= <any one of the 52 alphabetic characters
  1226.                        (A through Z in upper case, and,
  1227.                         a through z in lower case)>
  1228.      DIGIT        ::= <any one of the 10 numeric characters
  1229.                        (0 through 9)>
  1230.  
  1231.      CR           ::= <the carriage-return character
  1232.                        (ASCII decimal code 13)>
  1233.      LF           ::= <the line-feed character
  1234.                        (ASCII decimal code 10)>
  1235.      SP           ::= <the space character
  1236.                        (ASCII decimal code 32)>
  1237.  
  1238. Although EHLO keywords may be specified in upper, lower, or mixed
  1239. case, they must always be recognized and processed in a
  1240. case-insensitive manner. This is simply an extension of practices
  1241. begun in RFC 821.
  1242.  
  1243.  
  1244. 4.1.1.2 MAIL (MAIL)
  1245.  
  1246. This command is used to initiate a mail transaction in which the mail
  1247. data is delivered to one or more mailboxes.  The argument field
  1248. contains a reverse-path.
  1249.  
  1250. The reverse-path consists of an optional list of hosts and the sender
  1251. mailbox.  When the list of hosts is present, it is a "reverse" source
  1252. route and indicates that the mail was relayed through each host on
  1253. the list (the first host in the list was the most recent relay).
  1254. This list is used as a source route to return non-delivery notices to
  1255. the sender.  As each relay host adds itself to the beginning of the
  1256. list, it must use its name as known in the transport environment to
  1257. which it is relaying the mail rather than that of the transport
  1258. environment from which the mail came (if they are different).  In
  1259. some types of error reporting messages (for example, undeliverable
  1260. mail notifications) the reverse-path may be null (see Example 7).
  1261.  
  1262. This command clears the reverse-path buffer, the forward-path buffer,
  1263. and the mail data buffer; and inserts the reverse-path information
  1264. from this command into the reverse-path buffer.
  1265.  
  1266. If service extensions were negotiated, the MAIL command may also
  1267. carry parameters associated with a particular service extension. 
  1268.  
  1269. Syntax: MAIL FROM:<reverse-path> [ <mail-parameters> ]
  1270.                              or
  1271.         MAIL FROM:<>
  1272.  
  1273.  
  1274. 4.1.1.3 RECIPIENT (RCPT)
  1275.  
  1276. This command is used to identify an individual recipient of
  1277. the mail data; multiple recipients are specified by multiple
  1278. use of this command.
  1279.  
  1280. The forward-path consists of an optional list of hosts and a
  1281. required destination mailbox.  When the list of hosts is
  1282. present, it is a source route and indicates that the mail
  1283. must be relayed to the next host on the list.  If the
  1284. SMTP server does not implement the relay function it may
  1285. user the same reply it would for an unknown local user
  1286. (550).
  1287.  
  1288. When mail is relayed, the relay host must remove itself from
  1289. the beginning forward-path and put itself at the beginning
  1290. of the reverse-path.  When mail reaches its ultimate
  1291. destination (the forward-path contains only a destination
  1292. mailbox), the SMTP server inserts it into the destination
  1293. mailbox in accordance with its host mail conventions.
  1294.  
  1295.  
  1296.    For example, mail received at relay host A with arguments
  1297.  
  1298.       FROM:<USERX@HOSTY.ARPA>
  1299.       TO:<@HOSTA.ARPA,@HOSTB.ARPA:USERC@HOSTD.ARPA>
  1300.  
  1301.    will be relayed on to host B with arguments
  1302.  
  1303.       FROM:<@HOSTA.ARPA:USERX@HOSTY.ARPA>
  1304.       TO:<@HOSTB.ARPA:USERC@HOSTD.ARPA>.
  1305.  
  1306. This command causes its forward-path argument to be appended
  1307. to the forward-path buffer.
  1308.  
  1309. If service extensions were negotiated, the MAIL command may also
  1310. carry parameters associated with a particular service extension. 
  1311.  
  1312. Syntax: RCPT TO:<forward-path> [ <rcpt-parameters> ]
  1313.  
  1314.  
  1315. 4.1.1.4 DATA (DATA)
  1316.  
  1317. The receiver treats the lines (strings ending in CRLF sequences)
  1318. following the command as mail data from the sender.  This command
  1319. causes the mail data from this command to be appended to the mail
  1320. data buffer.  The mail data may contain any of the 128 ASCII
  1321. character codes.
  1322.  
  1323. SMTP is defined in terms of sending messages consisting of lines of
  1324. text.  Lines are strictly defined as ending in ASCII CR LF sequences.
  1325. Systems that use other line delimiting mechanisms internally MUST
  1326. convert to CR LF sequences before transmitting mail with unextended
  1327. SMTP or with any SMTP service extension on the standards track as of
  1328. the time of this writing.
  1329.  
  1330. The mail data is terminated by a line containing only a period, that
  1331. is the character sequence "<CRLF>.<CRLF>" (see Section 4.6.2 on
  1332. Transparency).  This is the end of mail data indication.
  1333.  
  1334. The custom of accepting lines ending only in LF, as a concession to
  1335. non-conforming behavior on the part of some UNIX systems, has proven
  1336. to cause more interoperability problems than it solves and SMTP
  1337. server systems MUST NOT do this, even in the name of improved
  1338. robustness.  In particular, the sequence "LF.LF" (bare line feeds,
  1339. without carriage returns) MUST NOT be treated as equivalent to
  1340. CRLF.CRLF as the end of mail data indication.
  1341.  
  1342.  
  1343. Receipt of the end of mail data indication requires that the server
  1344. process the stored mail transaction information.  This processing
  1345. consumes the information in the reverse-path buffer, the forward-path
  1346. buffer, and the mail data buffer, and on the completion of this
  1347. command these buffers are cleared.  If the processing is successful
  1348. the receiver must send an OK reply.  If the processing fails
  1349. completely the receiver must send a failure reply.
  1350.  
  1351. When the SMTP server accepts a message either for relaying or for
  1352. final delivery it inserts a trace record (also referred to
  1353. interchangabily as a "time stamp line" or "Received" line) at the top
  1354. of the mail data.  This trace record indicates the identity of the
  1355. host that sent the message, and the identity of the host that
  1356. received the message (and that is inserting this time stamp), and the
  1357. date and time the message was received.  Relayed messages will have
  1358. multiple time stamp lines.  Details for formation of these lines,
  1359. including their syntax, is specified in section 4.4.
  1360.  
  1361.  
  1362. 4.1.1.5 RESET (RSET)
  1363.  
  1364. This command specifies that the current mail transaction is to be
  1365. aborted.  Any stored sender, recipients, and mail data must be
  1366. discarded, and all buffers and state tables cleared.  The receiver
  1367. must send an OK reply.  A reset command may be issued by the client
  1368. at any time.   It is effectively equivalent to a NOOP if issued
  1369. immediately after EHLO or HELO, or before either of those commands
  1370. have been issued.  In other situations, it restores the state to
  1371. that immediately after the most recent EHLO or HELO.  An SMTP server
  1372. MUST NOT close the connection as the result of receiving a RSET; that
  1373. action is reserved for QUIT (see section 4.1.1.10, below).
  1374.  
  1375. 4.1.1.6  VERIFY (VRFY)
  1376.  
  1377. This command asks the receiver to confirm that the argument
  1378. identifies a user.  If it is a user name, the full name of
  1379. the user (if known) and the fully specified mailbox are
  1380. returned.
  1381.  
  1382. This command has no effect on any of the reverse-path
  1383. buffer, the forward-path buffer, or the mail data buffer.
  1384.  
  1385. 4.1.1.7 EXPAND (EXPN)
  1386.  
  1387. This command asks the receiver to confirm that the argument
  1388. identifies a mailing list, and if so, to return the
  1389. membership of that list.  The full name of the users (if
  1390. known) and the fully specified mailboxes are returned in a
  1391. multiline reply.
  1392.  
  1393. This command has no effect on any of the reverse-path
  1394. buffer, the forward-path buffer, or the mail data buffer.
  1395.  
  1396. 4.1.1.8 HELP (HELP)
  1397.  
  1398. This command causes the receiver to send helpful information
  1399. to the sender of the HELP command.  The command MAY take an
  1400. argument (e.g., any command name) and return more specific
  1401. information as a response.
  1402.  
  1403. This command has no effect on any of the reverse-path
  1404. buffer, the forward-path buffer, or the mail data buffer.
  1405.  
  1406. SMTP servers SHOULD support HELP even if the form with an argument
  1407. is not supported.
  1408.  
  1409.  
  1410. 4.1.1.9 NOOP (NOOP)
  1411.  
  1412. This command does not affect any parameters or previously
  1413. entered commands.  It specifies no action other than that
  1414. the receiver send an OK reply.
  1415.  
  1416. This command has no effect on any of the reverse-path
  1417. buffer, the forward-path buffer, or the mail data buffer.
  1418.  
  1419. 4.1.1.10 QUIT (QUIT)
  1420.  
  1421. This command specifies that the receiver must send an OK
  1422. reply, and then close the transmission channel.
  1423.  
  1424. The receiver MUST NOT intentionally close the transmission channel
  1425. until it receives and replies to a QUIT command (even if there was
  1426. an error).  The sender MUST NOT intentionally close the
  1427. transmission channel until it send a QUIT command and receives the
  1428. reply (even if there was an error response to a previous command).
  1429. If the connection is closed prematurely due to violations of the
  1430. above or system or network failure the server MUST act as if a
  1431. RSET command had been received (cancelling any pending
  1432. transaction, but not undoing any previously completed transaction)
  1433. and the client MUST act as if the command or transaction in
  1434. progress had received a temporary error (4xx).
  1435.  
  1436.  
  1437. 4.1.1.11  TURN (TURN)
  1438.  
  1439. This command, described in RFC 821, raises important security
  1440. issues (described in RFC 1123).  Its use is deprecated; SMTP
  1441. systems SHOULD NOT use it unless the server can authenticate the
  1442. client. 
  1443.  
  1444.  
  1445. 4.1.2.  LOWER-LEVEL SYNTAX
  1446.  
  1447. The syntax of the argument fields of the above commands (using BNF
  1448. notation where applicable) is given below.  The "..." notation
  1449. indicates that a field may be repeated one or more times.
  1450.  
  1451.    <reverse-path> ::= <path>  | "<>"
  1452.  
  1453.    <forward-path> ::= <path>
  1454.  
  1455.    <path> ::= "<" [ <a-d-l> ":" ] <mailbox> ">"
  1456.  
  1457.    <a-d-l> ::= <at-domain> | <at-domain> "," <a-d-l>
  1458.  
  1459.    <at-domain> ::= "@" <domain>
  1460.  
  1461.    <mail-parameters> ::= <<<>>
  1462.  
  1463.    <rcpt-parameters> ::= <<<>>
  1464.  
  1465. domain = sub-domain 1*("." sub-domain) | domain-literal
  1466.  
  1467. sub-domain = let-dig *(ldh-str)
  1468. domain-literal = "[" IP-address-literal "]"
  1469. IP-address-literal = snum 3*("." snum)
  1470. snum = one, two, or three digits representing a decimal
  1471.   integer value in the range 0 through 255
  1472. let-dig = Alpha / Digit
  1473. ldh-str = *( Alpha / Digit / "-" ) 1*(let-dig)
  1474.  
  1475. Alpha = ASCII character in the range A-Z or a-z.  As specified in
  1476.   the domain name system definition [RFC-DNS], case is not
  1477.   significant in domain strings.  
  1478. Digit = 0 - 9
  1479.  
  1480.  
  1481.    <mailbox> ::= <local-part> "@" <domain>
  1482.  
  1483.    <local-part> ::= <dot-string> | <quoted-string>
  1484.  
  1485.        While the definition for <local-part> above is relatively
  1486. permissive, for maximum interoperability, a host that expects to
  1487. receive mail SHOULD avoid defining mailboxes where the <local-part>
  1488. requires (or uses) the <quoted-string> form or where the <local-part>
  1489. is case-sensitive.
  1490.  
  1491.  
  1492. Systems MUST NOT define mailboxes in such a way as to require the use
  1493. of non-ASCII characters (octets with the high order bit set to one)
  1494. or ASCII "control characters" (decimal value 0-31 and 127).  These
  1495. characters MUST NOT be used in MAIL FROM or RCPT TO commands or other
  1496. commands that require mailbox names.
  1497.  
  1498.  
  1499. <<?>>   <string> ::= <char> | <char> <string>
  1500.  
  1501. <<?>>   <quoted-string> ::=  """ <qtext> """
  1502.  
  1503. <<?>>   <qtext> ::=  "\" <x> | "\" <x> <qtext> | <q> | <q> <qtext>
  1504.  
  1505.    <char> ::= <c> | "\" <x>
  1506.  
  1507.    <number> ::= <d> | <d> <number>
  1508.  
  1509.    <CRLF> ::= <CR> <LF>
  1510.  
  1511.    <CR> ::= the carriage return character (ASCII code 13)
  1512.  
  1513.    <LF> ::= the line feed character (ASCII code 10)
  1514.  
  1515.    <SP> ::= the space character (ASCII code 32)
  1516.  
  1517.    <snum> ::= one, two, or three digits representing a decimal
  1518.          integer value in the range 0 through 255
  1519.  
  1520.    <a> ::= any one of the 52 alphabetic characters A through Z
  1521.          in upper case and a through z in lower case
  1522.  
  1523.    <c> ::= any one of the 128 ASCII characters, but not any
  1524.          <special> or <SP>
  1525.  
  1526.    <d> ::= any one of the ten digits 0 through 9
  1527.  
  1528.    <q> ::= any one of the 128 ASCII characters except <CR>,
  1529.          <LF>, quote ("), or backslash (\)
  1530.  
  1531.    <x> ::= any one of the 128 ASCII characters (no exceptions)
  1532.  
  1533.    <special> ::= "<" | ">" | "(" | ")" | "[" | "]" | "\" | "."
  1534.          | "," | ";" | ":" | "@"  """ | the control
  1535.          characters (ASCII codes 0 through 31 inclusive and
  1536.          127)
  1537.  
  1538. Note that the backslash, "\", is a quote character, which is
  1539. used to indicate that the next character is to be used
  1540. literally (instead of its normal interpretation).  For example,
  1541. "Joe\,Smith" could be used to indicate a single nine character
  1542. user field with comma being the fourth character of the field.
  1543.  
  1544. Hosts are generally known by names which are translated to addresses
  1545. in each host.  Note that the name elements of domains must be
  1546. resolvable in the Internet domain system.  Local aliases or nicknames
  1547. MUST NOT be used.
  1548.  
  1549. Characters outside the set of specials, alphas, digits, and hyphen
  1550. are prohibited by the domain name system definition and MUST NOT
  1551. appear in domain names.  In particular, the underscore character is
  1552. not permitted.
  1553.  
  1554. Sometimes a host is not known to the translation function and
  1555. communication is blocked.  To bypass this barrier a numeric form is
  1556. also allowed for host "names". This form uses four or more small
  1557. decimal integers separated by dots and enclosed by brackets, e.g.,
  1558. "[123.255.37.2]", which indicates an Internet Address in
  1559. sequence-of-octets form.
  1560.  
  1561. The earlier escape form that uses a decimal integer prefixed by a
  1562. pound sign, "#", indicating the number is the address of the host, is
  1563. deprecated and MUST NOT be used.
  1564.  
  1565. The time stamp line and the return path line are formally defined as
  1566. follows:
  1567.  
  1568. <return-path-line> ::= "Return-Path:" <SP><reverse-path><CRLF>
  1569.  
  1570. <time-stamp-line> ::= "Received:" <SP> <stamp> <CRLF>
  1571.  
  1572. <stamp> ::= <from-domain> <by-domain> <opt-info> ";"
  1573.       <daytime>
  1574.  
  1575. <from-domain> ::= "FROM" <SP> <domain> <SP>
  1576.  
  1577. <by-domain> ::= "BY" <SP> <domain> <SP>
  1578.  
  1579. <opt-info> ::= [<via>] [<with>] [<id>] [<for>]
  1580.  
  1581. <via> ::= "VIA" <SP> <link> <SP>
  1582.  
  1583. <with> ::= "WITH" <SP> <protocol> <SP>
  1584.  
  1585. <id> ::= "ID" <SP> <string> <SP>
  1586.  
  1587. <for> ::= "FOR" <SP> <path> <SP>
  1588.  
  1589. <<>>FOR and <link> need to be nailed down.
  1590.  
  1591.    <link> ::= The standard names for links are registered with
  1592.          the Internet Assigned Numbers Authority (IANA).
  1593.  
  1594.    <protocol> ::= The standard names for protocols are
  1595.          registered with the Internet Assigned Numbers Authority
  1596.          (IANA). 
  1597.  
  1598.    <daytime> ::= <SP> <date> <SP> <time>
  1599.  
  1600.    <date> ::= <dd> <SP> <mon> <SP> <yyyy>
  1601.  
  1602.        Note that the earlier form, which permits
  1603.        two-digit years, is deprecated.  SMTP systems
  1604.        SHOULD use four-digit years.
  1605.  
  1606.    <time> ::= <hh> ":" <mm> ":" <ss> <SP> <zone>
  1607.  
  1608.    <dd> ::= the one or two decimal integer day of the month in
  1609.          the range 1 to 31.
  1610.  
  1611.    <mon> ::= "JAN" | "FEB" | "MAR" | "APR" | "MAY" | "JUN" |
  1612.          "JUL" | "AUG" | "SEP" | "OCT" | "NOV" | "DEC"
  1613.  
  1614.    <yyyy> ::= the four decimal integer year in the range 0000 to
  1615.              9999. 
  1616.  
  1617.    <hh> ::= the two decimal integer hour of the day in the
  1618.          range 00 to 24.
  1619.  
  1620.    <mm> ::= the two decimal integer minute of the hour in the
  1621.          range 00 to 59.
  1622.  
  1623.    <ss> ::= the two decimal integer second of the minute in the
  1624.          range 00 to 59.
  1625.  
  1626.    <zone> ::= A four-digit time zone offset, such as -0600 for US
  1627.              Eastern Standard Time.  This may be supplemented by a
  1628.          time zone name in parentheses, e.g., "-0800 (PDT)".  See
  1629.          ??? for additional discussion.
  1630.  
  1631.       Note that there is no default; time zone information
  1632.       is required and MUST be supplied.
  1633.  
  1634.             
  1635.  
  1636.      -------------------------------------------------------------
  1637.  
  1638.                           Return Path Example
  1639.  
  1640.          Return-Path: <@CHARLIE.ARPA,@BAKER.ARPA:JOE@ABLE.ARPA>
  1641.  
  1642.                                Example 9
  1643.  
  1644.      -------------------------------------------------------------
  1645.  
  1646.      -------------------------------------------------------------
  1647.  
  1648.                         Time Stamp Line Example
  1649.  
  1650.       Received: FROM ABC.ARPA BY XYZ.ARPA ; 22 OCT 81 09:23:59 PDT
  1651.  
  1652.          Received: from ABC.ARPA by XYZ.ARPA via TELENET with X25
  1653.                    id M12345 for Smith@PDQ.ARPA ; 22 OCT 81 09:23:59 PDT
  1654.  
  1655.                                Example 10
  1656.  
  1657.       -------------------------------------------------------------
  1658.  
  1659.  
  1660. 4.1.3.  Order of commands
  1661.  
  1662. There are restrictions on the order in which these commands may
  1663. be used.
  1664.  
  1665. A session that is to contain mail transactions MUST first be
  1666. initialized by the use of the HELO or EHLO command.  An SMTP server
  1667. SHOULD accept commands for non-mail transactions (e.g., VRFY or EXPN)
  1668. without this initialization.  
  1669.  
  1670. HELO or EHLO commands MAY be issued by a client later in the session.
  1671. If either is issued after the session begins, the SMTP server MUST
  1672. clear all buffers and state as if an RSET command had been issued.
  1673. In other words, the sequence of RSET followed immediately by HELO is
  1674. redundant, but not harmful other than in the performance cost of
  1675. executing unnecessary commands. 
  1676.  
  1677. If the HELO or EHLO commands are not acceptable to the SMTP server,
  1678. 501, 500, or 502 failure replies MUST be returned as appropriate.
  1679. The SMTP server must stay in the same state after transmitting these
  1680. replies as it was in before the HELO or EHLO were received.
  1681.  
  1682. RFC 1123 contains a discussion of arguments to HELO and conditions
  1683. under which the HELO command can be rejected.  In particular, HELO
  1684. (or EHLO) MUST NOT be rejected because the client's putative name
  1685. does not match some criteria established by the server (e.g.,
  1686. verification of reverse DNS mapping).
  1687.  
  1688. The NOOP, HELP, EXPN, VRFY, and RSET commands can be used at any time
  1689. during a session, or without previously initializing a session.  SMTP
  1690. servers SHOULD process these normally (i.e., not return a 503 code)
  1691. even if no HELO or EHLO command has yet been received; clients SHOULD
  1692. open a session with HELO or EHLO before sending these commands. 
  1693.  
  1694. If the above rules are followed, the example in RFC 821 that shows
  1695. "550 access denied to you" in response to an EXPN command is
  1696. essentially meaningless unless a HELO or EHLO command preceeds the
  1697. EXPN or the denial of access is based on the client's IP address. 
  1698.  
  1699. The MAIL, SEND, SOML, or SAML commands begin a mail transaction.
  1700. Once started a mail transaction consists of one of the transaction
  1701. beginning commands, one or more RCPT commands, and a DATA command, in
  1702. that order.  A mail transaction may be aborted by the RSET command.
  1703. There may be zero or more transactions in a session.
  1704.  
  1705. If the transaction beginning command argument is not acceptable a 501
  1706. failure reply MUST be returned and the SMTP server must stay in the
  1707. same state.  If the commands in a transaction are out of order to the
  1708. degree that they cannot be processed by the server a 503 failure
  1709. reply MUST be returned and the SMTP server must stay in the same
  1710. state.
  1711.  
  1712. The last command in a session must be the QUIT command.  The QUIT
  1713. command can not be used at any other time in a session, but may be
  1714. used by the client SMTP to request connection-closing even if no
  1715. session-opening command has been sent and accepted. 
  1716.  
  1717.  
  1718.  
  1719. 4.1.4 Private-use commands
  1720.  
  1721.  Commands starting in "X" may be used by bilateral agreement
  1722.  between the client (sending) and server (receiving) SMTPs.
  1723.  An SMTP server that does not recognize such a command is
  1724.  expected to reply with "500 Command not recognized".   An
  1725.  extended SMTP server MAY list the feature names associated
  1726.  with these private commands in the response to the EHLO
  1727.  command. 
  1728.  
  1729.  Commands sent or accepted by SMTP systems that do not start
  1730.  with "X" MUST be documented in published RFCs and be at
  1731.  least candidates for standardization. 
  1732.  
  1733.  
  1734.  
  1735. 4.2.  SMTP REPLIES
  1736.  
  1737. Replies to SMTP commands are devised to ensure the synchronization of
  1738. requests and actions in the process of mail transfer, and to
  1739. guarantee that the SMTP client always knows the state of the SMTP
  1740. server.  Every command must generate exactly one reply.
  1741.  
  1742. The details of the command-reply sequence are made explicit in
  1743. Section 4.3 on Sequencing and Section 4.5 containing State Diagrams.
  1744.  
  1745. An SMTP reply consists of a three digit number (transmitted as three
  1746. alphanumeric characters) followed by some text.  The number is
  1747. intended for use by automata to determine what state to enter next;
  1748. the text is meant for the human user.  It is intended that the three
  1749. digits contain enough encoded information that the SMTP client need
  1750. not examine the text and may either discard it or pass it on to the
  1751. user, as appropriate.  In particular, the text may be
  1752. receiver-dependent and context dependent, so there are likely to be
  1753. varying texts for each reply code.  A discussion of the theory of
  1754. reply codes is given in Appendix E.  Formally, a reply is defined to
  1755. be the sequence: a three-digit code, <SP>, one line of text, and
  1756. <CRLF>, or a multiline reply (as defined in Appendix E).  Only the
  1757. EXPN and HELP commands are expected to result in multiline replies in
  1758. normal circumstances, however multiline replies are allowed for any
  1759. command.
  1760.  
  1761. An SMTP server SHOULD send only the reply codes listed in
  1762. this document.  An SMTP server
  1763. SHOULD use the text shown in the examples whenever
  1764. appropriate.
  1765.  
  1766. A client SMTP MUST determine its actions only by the reply
  1767. code, not by the text (except for 251 and 551 replies); any
  1768. text, including no text at all, must be acceptable.  The space
  1769. (blank) following the reply code is considered part of the
  1770. text.  Whenever possible, a sender-SMTP SHOULD test only the
  1771. first digit of the reply code.
  1772.  
  1773.  
  1774.  
  1775.       4.2.1.  REPLY CODES BY FUNCTION GROUPS
  1776.  
  1777.          500 Syntax error, command unrecognized
  1778.             [This may include errors such as command line too long]
  1779.          501 Syntax error in parameters or arguments
  1780.          502 Command not implemented  (see section 4.2.3)
  1781.          503 Bad sequence of commands
  1782.          504 Command parameter not implemented
  1783.           
  1784.          211 System status, or system help reply
  1785.          214 Help message
  1786.             [Information on how to use the receiver or the meaning of a
  1787.             particular non-standard command; this reply is useful only
  1788.             to the human user]
  1789.           
  1790.          220 <domain> Service ready
  1791.          221 <domain> Service closing transmission channel
  1792.          421 <domain> Service not available,
  1793.              closing transmission channel
  1794.             [This may be a reply to any command if the service knows it
  1795.             must shut down]
  1796.           
  1797.          250 Requested mail action okay, completed
  1798.          251 User not local; will forward to <forward-path>
  1799.          252 Cannot VRFY user, but will accept message and attempt delivery
  1800.          450 Requested mail action not taken: mailbox unavailable
  1801.             [E.g., mailbox busy]
  1802.          550 Requested action not taken: mailbox unavailable
  1803.             [E.g., mailbox not found, no access]
  1804.          451 Requested action aborted: error in processing
  1805.          551 User not local; please try <forward-path>
  1806.          452 Requested action not taken: insufficient system storage
  1807.          552 Requested mail action aborted: exceeded storage allocation
  1808.          553 Requested action not taken: mailbox name not allowed
  1809.             [E.g., mailbox syntax incorrect]
  1810.          354 Start mail input; end with <CRLF>.<CRLF>
  1811.          554 Transaction failed
  1812.          
  1813.  
  1814.       4.2.2.  NUMERIC ORDER LIST OF REPLY CODES
  1815.  
  1816.          211 System status, or system help reply
  1817.          214 Help message
  1818.             [Information on how to use the receiver or the meaning of a
  1819.             particular non-standard command; this reply is useful only
  1820.             to the human user]
  1821.          220 <domain> Service ready
  1822.          221 <domain> Service closing transmission channel
  1823.          250 Requested mail action okay, completed
  1824.          251 User not local; will forward to <forward-path>
  1825.          252 Cannot VRFY user, but will accept message and attempt delivery
  1826.           
  1827.          354 Start mail input; end with <CRLF>.<CRLF>
  1828.           
  1829.          421 <domain> Service not available,
  1830.              closing transmission channel
  1831.             [This may be a reply to any command if the service knows it
  1832.             must shut down]
  1833.          450 Requested mail action not taken: mailbox unavailable
  1834.             [E.g., mailbox busy]
  1835.          451 Requested action aborted: local error in processing
  1836.          452 Requested action not taken: insufficient system storage
  1837.           
  1838.          500 Syntax error, command unrecognized
  1839.             [This may include errors such as command line too long]
  1840.          501 Syntax error in parameters or arguments
  1841.          502 Command not implemented
  1842.          503 Bad sequence of commands
  1843.          504 Command parameter not implemented
  1844.          550 Requested action not taken: mailbox unavailable
  1845.             [E.g., mailbox not found, no access]
  1846.          551 User not local; please try <forward-path>
  1847.          552 Requested mail action aborted: exceeded storage allocation
  1848.          553 Requested action not taken: mailbox name not allowed
  1849.             [E.g., mailbox syntax incorrect]
  1850.          554 Transaction failed
  1851.          
  1852.  
  1853. 4.2.3.  Reply code 502
  1854.  
  1855. Questions have been raised as to when reply code 502 (Command
  1856. not implemented) should be returned in preference to other
  1857. codes.  502 SHOULD be used when the command is actually
  1858. recognized by the SMTP server, but not implemented.   If the
  1859. command is not recognized, code 500 SHOULD be returned.
  1860. Extended SMTP systems MUST NOT list capabilities in response to
  1861. EHLO for which they will return 502 (or 500) replies.
  1862.  
  1863.  
  1864. 4.2.4  Reply codes after DATA and the subsequent CRLF.CRLF.
  1865.  
  1866. When an SMTP server returns a positive completion status (2yz
  1867. code) after the DATA command is completed with CRLF.CRLF, it
  1868. accepts responsibity for:
  1869.  
  1870. + delivering the message (if the recipient mailbox exists), or 
  1871.  
  1872. + if attempts to deliver the message fail due to transient
  1873.   conditions, retrying delivery some reasonable number of times
  1874.   at intervals as specified in RFC 1123, or
  1875.  
  1876. + if attempts to deliver the message fail due to permanent
  1877.   conditions, or if repeated attempts to deliver the message
  1878.   fail due to transient conditions, returning appropriate
  1879.   notification to the sender of the original message (using the
  1880.   address in the SMTP MAIL FROM command). 
  1881.  
  1882.  
  1883. When an SMTP server returns a transient error completion status
  1884. (4yz) code after the DATA command is completed with CRLF.CRLF,
  1885. it MUST NOT make any further attempt to deliver that message.
  1886. The SMTP client retains responsibility for delivery of that
  1887. message.  The sending user should be able to interpret the
  1888. return of a transient or permanent failure status as a
  1889. non-delivery indication.
  1890.  
  1891.  
  1892.  
  1893.  
  1894. 4.3.  SEQUENCING OF COMMANDS AND REPLIES
  1895.  
  1896. 4.3.1 Sequencing overview
  1897.  
  1898. The communication between the sender and receiver is intended to be
  1899. an alternating dialogue, controlled by the sender.  As such, the
  1900. sender issues a command and the receiver responds with a reply.
  1901. Unless other arrangements are negotiated through service extensions,
  1902. the sender must wait for this response before sending further
  1903. commands.
  1904.  
  1905. One important reply is the connection greeting.  Normally, a receiver
  1906. will send a 220 "Service ready" reply when the connection is
  1907. completed.  The sender should wait for this greeting message before
  1908. sending any commands.
  1909.  
  1910. Note: all the greeting type replies have the official name (i.e., the
  1911. fully-qualified primary domain name) of the server host as the first
  1912. word following the reply code.  When the host has no name, the IP
  1913. address should be used, in bracketed dotted-octet format, e.g.,
  1914. [10.0.0.6].
  1915.  
  1916.       For example,
  1917.  
  1918.      220 <SP> USC-ISIF.ARPA <SP> Service ready <CRLF>
  1919.  
  1920.  
  1921. The table below lists alternative success and failure replies for
  1922. each command.  These must be strictly adhered to; a receiver may
  1923. substitute text in the replies, but the meaning and action implied
  1924. by the code numbers and by the specific command reply sequence
  1925. cannot be altered.
  1926.  
  1927. COMMAND-REPLY SEQUENCES
  1928.  
  1929. Each command is listed with its usual possible replies.  The prefixes
  1930. used before the possible replies are "P" for preliminary (not used in
  1931. SMTP), "I" for intermediate, "S" for success, "F" for failure, and
  1932. "E" for error.  The 421 reply (service not available, closing
  1933. transmission channel) may be given to any command if the
  1934. SMTP-receiver knows it must shut down.  Since some servers may
  1935. generate other replies under special circumstances, and to allow for
  1936. future extension, SMTP clients SHOULD, when possible, interpret only
  1937. the first digit of the reply and MUST be prepared to deal with
  1938. unrecognized reply codes by interpreting the first digit only.  SMTP
  1939. servers MUST NOT transmit reply codes to an SMTP client that are
  1940. other than three digits or that do not start in a digit between 2 and
  1941. 5 inclusive.  This listing forms the basis for the State Diagrams in
  1942. Section 4.5.
  1943.  
  1944.       CONNECTION ESTABLISHMENT
  1945.      S: 220
  1946.      F: 421
  1947.       HELO
  1948.      S: 250
  1949.      E: 500, 501, 504, 421
  1950.       MAIL
  1951.      S: 250
  1952.      F: 552, 451, 452
  1953.      E: 500, 501, 421
  1954.       RCPT
  1955.      S: 250, 251 (but see section <<<>>> for discussion of 251)
  1956.      F: 550, 551, 552, 553, 450, 451, 452
  1957.      E: 500, 501, 503, 421
  1958.       DATA
  1959.      I: 354 -> data -> S: 250
  1960.                F: 552, 554, 451, 452
  1961.      F: 451, 554
  1962.      E: 500, 501, 503, 421
  1963.       RSET
  1964.      S: 250
  1965.      E: 500, 501, 504, 421
  1966.       SEND
  1967.      S: 250
  1968.      F: 552, 451, 452
  1969.      E: 500, 501, 502, 421
  1970.       SOML
  1971.      S: 250
  1972.      F: 552, 451, 452
  1973.      E: 500, 501, 502, 421
  1974.       SAML
  1975.      S: 250
  1976.      F: 552, 451, 452
  1977.      E: 500, 501, 502, 421
  1978.       VRFY
  1979.      S: 250, 251
  1980.      F: 550, 551, 553
  1981.      E: 500, 501, 502, 504, 421
  1982.       EXPN
  1983.      S: 250
  1984.      F: 550
  1985.      E: 500, 501, 502, 504, 421
  1986.       HELP
  1987.      S: 211, 214
  1988.      E: 500, 501, 502, 504, 421
  1989.       NOOP
  1990.      S: 250
  1991.      E: 500, 421
  1992.       QUIT
  1993.      S: 221
  1994.      E: 500
  1995.       TURN
  1996.      S: 250
  1997.      F: 502
  1998.      E: 500, 503
  1999.  
  2000.  
  2001.  
  2002. 4.4 Trace information
  2003.  
  2004. When an SMTP server receives a message for delivery or further
  2005. processing, it MUST insert trace ("time stamp" or "Received"
  2006. information at the beginning of the message body, as discussed under
  2007. the DATA command in section 4.1.1.4.
  2008.  
  2009. This line must be structured as follows:
  2010.  
  2011.    *    The FROM field SHOULD contain both (1) the name of the
  2012.     source host as presented in the EHLO or HELO command and (2) a
  2013.     domain literal containing the IP address of the source,
  2014.     determined from the TCP connection.
  2015.  
  2016.    *    The ID field MAY contain an "@" as suggested in RFC-822,
  2017.     but this is not required.
  2018.  
  2019.    *    The FOR field MAY contain a list of <path> entries when
  2020.     multiple RCPT commands have been given.
  2021.  
  2022. An Internet mail program MUST NOT change a Received: line that was
  2023. previously added to the message header.
  2024.  
  2025.  
  2026. As the Internet grows, comparability of Received fields is important
  2027. for detecting problems, especially slow relays.  SMTP servers that
  2028. create Received fields SHOULD use explicit offsets in the dates
  2029. (e.g., -0800), rather than time zone names of any type.  If it is
  2030. desired to also use a time zone name, it should be included in a
  2031. commment.
  2032.  
  2033.  
  2034. When the SMTP server makes the "final delivery" of a message it
  2035. inserts a return-path line at the beginning of the mail data.  This
  2036. use of return-path is required; mail systems MUST support it.  The
  2037. return path line preserves the information in the <reverse-path> from
  2038. the MAIL command.  Here, final delivery means the message leaves the
  2039. SMTP world.  Normally, this would mean it has been delivered to the
  2040. destination user, but in some cases it may be further processed and
  2041. transmitted by another mail system.
  2042.  
  2043. It is possible for the mailbox in the return path be different from
  2044. the actual sender's mailbox, for example, if error responses are to
  2045. be delivered a special error handling mailbox rather than to that of
  2046. the message sender.  When mailing lists are involved, this
  2047. arrangement is common and useful as a means of directing errors to
  2048. the list maintainer rather than the message originator.
  2049.  
  2050. The preceding two paragraphs imply that the final mail data will
  2051. begin with a return path line, followed by one or more time stamp
  2052. lines.  These lines will be followed by the mail data header and body
  2053. [RFC822].  See Example 8.
  2054.  
  2055. It is sometimes difficult for an SMTP server to determine whether or
  2056. not it is making final delivery since forwarding or other operations
  2057. may occur after the message is accepted for delivery.  However any
  2058. further (forwarding, gateway, or relay) systems MAY remove the return
  2059. path and rebuild the MAIL FROM command as needed to ensure that
  2060. exactly one such line appears in a delivered message.  
  2061.  
  2062. A message-originating SMTP system SHOULD NOT send a message that
  2063. already contains a Return-path header.  If a message that contains
  2064. more than one Return-path header is received, only the first
  2065. Return-path header line in the message header is valid.  A message
  2066. header processor SHOULD discard or, if necessary just ignore, any
  2067. Return-path headers following the first one.
  2068.  
  2069. The primary intent of the Return-path is that it designates the
  2070. address to which messages indicating non-delivery or other mail
  2071. system failures at to be sent.  For this to be unambigious, exactly
  2072. one return path should be present when the message is delivered.
  2073. Systems using RFC 822 syntax with non-SMTP transports SHOULD preserve
  2074. the intent of having an unambiguous address, associated with the
  2075. transport envelope, to which to send error reports (e.g.,
  2076. non-delivery messages).
  2077.  
  2078. Historical note: Text in RFC 822 that appears to contradict the use
  2079. of Return-path (or the envelope MAIL FROM address) as the destination
  2080. of error messages is not applicable on the Internet.  The MAIL FROM
  2081. address (as copied into the Return-path) MUST be used as the target
  2082. of any mail containing delivery error messages.
  2083.  
  2084. In particular,
  2085.  
  2086. (i)  a gateway from SMTP->elsewhere SHOULD insert a return-path
  2087. header, unless it is known that the "elsewhere" transport
  2088. also uses Internet domain addresses and maintains the
  2089. envelope sender address separately.
  2090.  
  2091. (ii)  a gateway from elsewhere->SMTP SHOULD delete any
  2092. return-path header present in the message, and either copy
  2093. that information to the SMTP envelope or combine it with
  2094. information present in the envelope of the other transport
  2095. system to construct the MAIL FROM part of the SMTP envelope.
  2096.  
  2097.  
  2098. Special mention is needed of the response and further action required
  2099. when the processing following the end of mail data indication is
  2100. partially successful.  This could arise if after accepting several
  2101. recipients and the mail data, the SMTP server finds that the mail
  2102. data can be successfully delivered to some of the recipients, but it
  2103. cannot be to others (for example, due to mailbox space allocation
  2104. problems).  In such a situation, the response to the DATA command
  2105. must be an OK reply.  But, the SMTP server must compose and send an
  2106. "undeliverable mail" notification message to the originator of the
  2107. message.  Either a single notification which lists all of the
  2108. recipients that failed to get the message, or separate notification
  2109. messages must be sent for each failed recipient (see Example 7).  All
  2110. undeliverable mail notification messages are sent using the MAIL
  2111. command (even if they result from processing a SEND, SOML, or SAML
  2112. command).
  2113.  
  2114.  
  2115.  
  2116.  
  2117. -------------------------------------------------------------
  2118.  
  2119.    Example of Return Path and Received Time Stamps
  2120.  
  2121. Return-Path: <@GHI.ARPA,@DEF.ARPA,@ABC.ARPA:JOE@ABC.ARPA>   
  2122. Received: from GHI.ARPA by JKL.ARPA ; 27 Oct 81 15:27:39 PST
  2123. Received: from DEF.ARPA by GHI.ARPA ; 27 Oct 81 15:15:13 PST
  2124. Received: from ABC.ARPA by DEF.ARPA ; 27 Oct 81 15:01:59 PST
  2125. Date: 27 Oct 81 15:01:01 PST                                
  2126. From: JOE@ABC.ARPA                                          
  2127. Subject: Improved Mailing System Installed                  
  2128. To: SAM@JKL.ARPA                                            
  2129.  
  2130. This is to inform you that ...                              
  2131.  
  2132.               Example 8
  2133.  
  2134. -------------------------------------------------------------
  2135.  
  2136.  
  2137.  
  2138.  
  2139.  
  2140.  
  2141. 4.5.  STATE DIAGRAMS
  2142.  
  2143. Following are state diagrams for a simple-minded SMTP
  2144. implementation.  Only the first digit of the reply codes is used.
  2145. There is one state diagram for each group of SMTP commands.  The
  2146. command groupings were determined by constructing a model for each
  2147. command and then collecting together the commands with
  2148. structurally identical models.
  2149.  
  2150. For each command there are three possible outcomes:  "success"
  2151. (S), "failure" (F), and "error" (E). In the state diagrams below
  2152. we use the symbol B for "begin", and the symbol W for "wait for
  2153. reply".
  2154.  
  2155. First, the diagram that represents most of the SMTP commands:
  2156.  
  2157.          
  2158.                                   1,3    +---+
  2159.                              ----------->| E |
  2160.                             |            +---+
  2161.                             |
  2162.          +---+    cmd    +---+    2      +---+
  2163.          | B |---------->| W |---------->| S |
  2164.          +---+           +---+           +---+
  2165.                             |
  2166.                             |     4,5    +---+
  2167.                              ----------->| F |
  2168.                                          +---+
  2169.          
  2170.  
  2171.    This diagram models the commands:
  2172.  
  2173.       HELO, EHLO, MAIL, RCPT, RSET, SEND, SOML, SAML, VRFY, EXPN, 
  2174.       HELP, NOOP, QUIT, TURN.
  2175.  
  2176.  
  2177.  
  2178.  
  2179.       A more complex diagram models the DATA command:
  2180.  
  2181.          
  2182.          +---+   DATA    +---+ 1,2                 +---+
  2183.          | B |---------->| W |-------------------->| E |
  2184.          +---+           +---+        ------------>+---+
  2185.                          3| |4,5     |
  2186.                           | |        |
  2187.             --------------   -----   |
  2188.            |                      |  |             +---+
  2189.            |               ----------     -------->| S |
  2190.            |              |       |      |         +---+
  2191.            |              |  ------------
  2192.            |              | |     |
  2193.            V           1,3| |2    |
  2194.          +---+   data    +---+     --------------->+---+
  2195.          |   |---------->| W |                     | F |
  2196.          +---+           +---+-------------------->+---+
  2197.                               4,5
  2198.  
  2199.  
  2200.          Note that the "data" here are a series of lines sent from the
  2201.          sender to the receiver with no response expected until the last
  2202.          line is sent.
  2203.  
  2204.  
  2205. 4.6.  DETAILS
  2206.  
  2207. 4.6.1.  MINIMUM IMPLEMENTATION
  2208.  
  2209.    In order to make SMTP workable, the following minimum
  2210.    implementation is required for all receivers:
  2211.  
  2212.       COMMANDS -- HELO
  2213.           VRFY
  2214.           MAIL
  2215.           RCPT
  2216.           DATA
  2217.           RSET
  2218.           NOOP
  2219.           QUIT
  2220.  
  2221. Any system that includes an SMTP server that supports RCPT MUST
  2222. support the reserved mailbox "Postmaster" as a case-insensitive
  2223. mailbox name.
  2224.  
  2225.  
  2226.  
  2227. 4.6.2.  TRANSPARENCY
  2228.  
  2229.    Without some provision for data transparency the character
  2230.    sequence "<CRLF>.<CRLF>" ends the mail text and cannot be sent
  2231.    by the user.  In general, users are not aware of such
  2232.    "forbidden" sequences.  To allow all user composed text to be
  2233.    transmitted transparently the following procedures are used.
  2234.  
  2235.       1. Before sending a line of mail text the SMTP client checks
  2236.       the first character of the line.  If it is a period, one
  2237.       additional period is inserted at the beginning of the line.
  2238.  
  2239.       2. When a line of mail text is received by the SMTP server
  2240.       it checks the line.  If the line is composed of a single
  2241.       period it is the end of mail.  If the first character is a
  2242.       period and there are other characters on the line, the first
  2243.       character is deleted.
  2244.  
  2245.    The mail data may contain any of the 128 ASCII characters.  All
  2246.    characters are to be delivered to the recipient's mailbox
  2247.    including format effectors and other control characters.  If
  2248.    the transmission channel provides an 8-bit byte (octets) data
  2249.    stream, the 7-bit ASCII codes are transmitted right justified
  2250.    in the octets with the high order bits cleared to zero.
  2251.  
  2252.       In some systems it may be necessary to transform the data as
  2253.       it is received and stored.  This may be necessary for hosts
  2254.       that use a different character set than ASCII as their local
  2255.       character set, or that store data in records rather than
  2256.       strings.  If such transforms are necessary, they must be
  2257.       reversible -- especially if such transforms are applied to
  2258.       mail being relayed.
  2259.  
  2260.  
  2261. 4.6.3.  SIZES AND TIMEOUTS
  2262.  
  2263. There are several objects that have required minimum maximum
  2264. sizes.  That is, every implementation must be able to receive
  2265. objects of at least these sizes, but must not send objects
  2266. larger than these sizes.
  2267.  
  2268.  
  2269. ****************************************************
  2270. *                                                  *
  2271. *  TO THE MAXIMUM EXTENT POSSIBLE, IMPLEMENTATION  *
  2272. *  TECHNIQUES WHICH IMPOSE NO LIMITS ON THE LENGTH *
  2273. *  OF THESE OBJECTS SHOULD BE USED.                *
  2274. *                                                  *
  2275. ****************************************************
  2276.  
  2277. user
  2278.  
  2279.    The maximum total length of a user name is 64 characters.
  2280.  
  2281. domain
  2282.  
  2283.    The maximum total length of a domain name or number is 64
  2284.    characters.
  2285.  
  2286. path
  2287.  
  2288.    The maximum total length of a reverse-path or
  2289.    forward-path is 256 characters (including the punctuation
  2290.    and element separators).
  2291.  
  2292. command line
  2293.  
  2294.    The maximum total length of a command line including the
  2295.    command word and the <CRLF> is 512 characters.
  2296.  
  2297. reply line
  2298.  
  2299.    The maximum total length of a reply line including the
  2300.    reply code and the <CRLF> is 512 characters.
  2301.  
  2302.  
  2303. text line
  2304.  
  2305.    The maximum total length of a text line including the
  2306.    <CRLF> is 1000 characters (but not counting the leading
  2307.    dot duplicated for transparency).  This number may be increased by
  2308.    the use of SMTP Service Extensions.
  2309.  
  2310. message body
  2311.  
  2312.    The maximum total length of a message body (including any message
  2313.    headers) MUST BE at least 64K octets.  Especially since the
  2314.    introduction of multimedia mail [RFC-MIME], message lengths on the
  2315.    Internet have grown dramatically, and message size restrictions
  2316.    should be avoided if at all possible.  SMTP server systems that must
  2317.    impose restrictions SHOULD implement the "SIZE" service extension
  2318.    ([RFC-SIZE]) and SMTP client systems that will send large messages
  2319.    SHOULD utilize it when possible.
  2320.  
  2321. recipients buffer
  2322.  
  2323.    The maximum total number of recipients that must be
  2324.    buffered is 100 recipients.
  2325.  
  2326.  
  2327. ****************************************************
  2328. *                                                  *
  2329. *  TO THE MAXIMUM EXTENT POSSIBLE, IMPLEMENTATION  *
  2330. *  TECHNIQUES WHICH IMPOSE NO LIMITS ON THE LENGTH *
  2331. *  OF THESE OBJECTS SHOULD BE USED.                *
  2332. *                                                  *
  2333. ****************************************************
  2334.  
  2335. Errors due to exceeding these limits may be reported by using
  2336. the reply codes, for example:
  2337.  
  2338. 500 Line too long.
  2339.  
  2340. 501 Path too long
  2341.  
  2342. 552 Too many recipients.
  2343.  
  2344. 552 Too much mail data.
  2345.  
  2346.  
  2347. An SMTP client should provide timeouts for all commands.  Minimum
  2348. values SHOULD be as follows:
  2349.  
  2350. o    Initial 220 Message: 5 minutes
  2351.  
  2352.      An SMTP client process needs to distinguish between a
  2353.      failed TCP connection and a delay in receiving the initial
  2354.      220 greeting message.  Many SMTP servers will accept a
  2355.      TCP connection but delay delivery of the 220 message until
  2356.      their system load will permit more mail to be processed.
  2357.  
  2358. o    MAIL Command: 5 minutes
  2359.  
  2360.  
  2361. o    RCPT Command: 5 minutes
  2362.  
  2363.      A longer timeout would be required if processing of
  2364.      mailing lists and aliases were not deferred until after
  2365.      the message was accepted.
  2366.  
  2367. o    DATA Initiation: 2 minutes
  2368.  
  2369.      This is while awaiting the "354 Start Input" reply to a
  2370.      DATA command.
  2371.  
  2372. o    Data Block: 3 minutes
  2373.  
  2374.      This is while awaiting the completion of each TCP SEND
  2375.      call transmitting a chunk of data.
  2376.  
  2377. o    DATA Termination: 10 minutes.
  2378.  
  2379.      This is while awaiting the "250 OK" reply. When the
  2380.      receiver gets the final period terminating the message
  2381.      data, it typically performs processing to deliver the
  2382.      message to a user mailbox.  A spurious timeout at this
  2383.      point would be very wasteful, since the message has been
  2384.      successfully sent.
  2385.  
  2386. An SMTP server SHOULD have a timeout of at least 5 minutes
  2387. while it is awaiting the next command from the sender.
  2388.  
  2389.  
  2390. 4.6.4   Queuing Strategies
  2391.  
  2392. The common structure of a host SMTP implementation includes
  2393. user mailboxes, one or more areas for queueing messages in
  2394. transit, and one or more daemon processes for sending and
  2395. receiving mail.  The exact structure will vary depending on the
  2396. needs of the users on the host and the number and size of
  2397. mailing lists supported by the host.  We describe several
  2398. optimizations that have proved helpful, particularly for
  2399. mailers supporting high traffic levels.
  2400.  
  2401. Any queueing strategy MUST include:
  2402.  
  2403. o    Timeouts on all activities on a per-command basis
  2404.  
  2405. o    Never sending error messages in response to error messages.
  2406.  
  2407.  
  2408. 4.6.4.1 Sending Strategy
  2409.  
  2410.    The general model of an SMTP client is one or more processes
  2411.    that periodically attempt to transmit outgoing mail.  In a
  2412.    typical system, the program that composes a message has some
  2413.    method for requesting immediate attention for a new piece of
  2414.    outgoing mail, while mail that cannot be transmitted
  2415.    immediately MUST be queued and periodically retried by the
  2416.    sender.  A mail queue entry will include not only the
  2417.    message itself but also the envelope information.
  2418.  
  2419.    The sender MUST delay retrying a particular destination
  2420.    after one attempt has failed.  In general, the retry
  2421.    interval SHOULD be at least 30 minutes; however, more
  2422.    sophisticated and variable strategies will be beneficial
  2423.    when the SMTP client can determine the reason for non-
  2424.    delivery.
  2425.  
  2426.    Retries continue until the message is transmitted or the
  2427.    sender gives up; the give-up time generally needs to be at
  2428.    least 4-5 days.  The parameters to the retry algorithm MUST
  2429.    be configurable.
  2430.  
  2431.    A sender SHOULD keep a list of hosts it cannot reach and
  2432.    corresponding connection timeouts, rather than just retrying queued 
  2433.    mail items.
  2434.  
  2435.    DISCUSSION:
  2436.     Experience suggests that failures are typically
  2437.     transient (the target system has crashed), favoring a
  2438.     policy of two connection attempts in the first hour the
  2439.     message is in the queue, and then backing off to once
  2440.     every two or three hours.
  2441.  
  2442.     The SMTP client can shorten the queueing delay by
  2443.     cooperation with the SMTP server.  In particular, if
  2444.     mail is received from a particular address, it is good
  2445.     evidence that any mail queued for that host can now be
  2446.     sent.
  2447.  
  2448.     The strategy may be further modified as a result of
  2449.     multiple addresses per host (see Section 5.3.4), to
  2450.     optimize delivery time vs. resource usage.
  2451.  
  2452.     an SMTP client may have a large queue of messages for
  2453.     each unavailable destination host, and if it retried
  2454.     all these messages in every retry cycle, there would be
  2455.     excessive Internet overhead and the daemon would be
  2456.     blocked for a long period.  Note that an SMTP can
  2457.     generally determine that a delivery attempt has failed
  2458.     only after a timeout of a minute or more; a one minute
  2459.     timeout per connection will result in a very large
  2460.     delay if it is repeated for dozens or even hundreds of
  2461.     queued messages.
  2462.  
  2463.    When the same message is to be delivered to several users on
  2464.    the same host, only one copy of the message SHOULD be
  2465.    transmitted.  That is, the SMTP client should use the
  2466.    command sequence: RCPT, RCPT,... RCPT, DATA instead of the
  2467.    sequence: RCPT, DATA, RCPT, DATA,... RCPT, DATA.
  2468.    Implementation of this efficiency feature is strongly urged.
  2469.  
  2470.    Similarly, the SMTP client MAY support multiple concurrent
  2471.    outgoing mail transactions to achieve timely delivery.
  2472.    However, some limit SHOULD be imposed to protect the host
  2473.    from devoting all its resources to mail.
  2474.  
  2475. 4.6.4.2  Receiving strategy
  2476.  
  2477.    The SMTP server SHOULD attempt to keep a pending listen on
  2478.    the SMTP port at all times.  This will require the support
  2479.    of multiple incoming TCP connections for SMTP.  Some limit
  2480.    MAY be imposed.
  2481.  
  2482.    IMPLEMENTATION:
  2483.     When the SMTP server receives mail from a particular
  2484.     host address, it could notify the SMTP client to retry
  2485.     any mail pending for that host address.
  2486.  
  2487.  
  2488.  
  2489. 5. Problem detection and handling
  2490.  
  2491. 5.1 Replies by email
  2492.  
  2493.   <<>>
  2494.  
  2495. 5.2 Loop detection
  2496.  
  2497. Simple counting of the number of Received lines in a message has not
  2498. proven to be a desirable method of detecting loops in mail systems,
  2499. and SMTP servers SHOULD NOT use that technique.  Loop detection by
  2500. examination of Received fields for the domain name or other signature
  2501. of the SMTP server making the check is effective and MAY be used by
  2502. SMTP servers.
  2503.  
  2504.  
  2505.  
  2506. 6.  Security Considerations
  2507.  
  2508. 6.1 Mail security and spoofing
  2509.  
  2510. SMTP mail is inherently insecure in that it is feasible for even
  2511. fairly casual users to negotiate directly with receiving and
  2512. relaying SMTP servers and create messages that will trick a
  2513. naive recipient into believing that they came from somewhere
  2514. else.   Constructing such a message so that the "spoofed"
  2515. behavior cannot be detected by an expert is somewhat more
  2516. difficult, but not sufficiently so as to be a deterrent to
  2517. someone who is determined and knowledgeable.
  2518.  
  2519. Consequently, as knowledge of Internet mail increases, so
  2520. does the knowledge 
  2521. that SMTP mail inherently cannot be authenticated, or integrity
  2522. checks provided, at the transport level.  Real security lies only in
  2523. end-to-end methods involving the message bodies, e.g., those
  2524. that can be provided in the MOSS framework [RFC-MOSS].
  2525.  
  2526. A corollary to this is that efforts to make it more difficult
  2527. for users to set envelope MAIL FROM and header "From" fields
  2528. to point to valid addresses other than their own are largely
  2529. misguided: they do not prevent any would-be mail spoofer from
  2530. doing so, and do frustrate legitimate applications in which
  2531. mail is sent by one user on behalf of another or in which
  2532. error (or normal) replies should be directed to a special
  2533. address.  On the other hand, systems that provide convenient
  2534. ways for users to alter these fields on a per-message basis
  2535. should attempt to establish a primary and permanent mailbox
  2536. address for the user so that Sender fields can be generated
  2537. correctly.
  2538.  
  2539. This specification does not further address the security issues
  2540. associated with SMTP other than to advocate that useful
  2541. functionality not be disabled in the hope of providing some
  2542. small margin of protection against an ignorant user who is
  2543. trying to fake mail.
  2544.  
  2545.  
  2546.  
  2547. 6.2 "Blind" copies.
  2548.  
  2549. Addresses may appear in the RCPT TO commands to an SMTP server
  2550. that do not appear in the message headers for a number of
  2551. reasons.  The two most common of these involve the use of a
  2552. mailing address as a "list exploder" -- a single address that
  2553. resolves into multiple addresses -- and the appearance of "blind
  2554. copies".  In order to avoid defeating some of the purpose of
  2555. these mechanisms, SMTP clients and servers SHOULD NOT copy the
  2556. RCPT TO command arguments into the headers, even as
  2557. informational or private-extension headers.  Since this rule is 
  2558. often violated in practice, and cannot be enforced, sending SMTP
  2559. systems that are aware of "bcc" use MAY find it helpful to send
  2560. each blind copy as a separate message transaction containing
  2561. only a single RCPT TO command.
  2562.  
  2563. More generally, while there are often similarities, there is no
  2564. inherent relationship between either "reverse" (MAIL FROM, SAML FROM,
  2565. etc.) or "forward" (RCPT TO) addresses in the SMTP transaction
  2566. ("envelope") and the addresses in the headers.  Receiving systems
  2567. SHOULD NOT attempt to deduce such relationships and use them to alter
  2568. the headers of the message for delivery.  The popular "Apparently-to"
  2569. header is a violation of this principle and SHOULD NOT be used.
  2570.  
  2571. See also section ##2.2.4.
  2572.  
  2573.  
  2574. 7.  REFERENCES
  2575.  
  2576. [1]  ASCII
  2577.  
  2578.    ASCII, "USA Code for Information Interchange", United States of
  2579.    America Standards Institute, X3.4, 1968.
  2580.  
  2581. [RFC822]
  2582.    Crocker, D., "Standard for the Format of ARPA Internet Text
  2583.    Messages", RFC 822, Department of Electrical Engineering,
  2584.    University of Delaware, August 1982.
  2585.  
  2586. [3]  TCP
  2587.    Postel, J., ed., "Transmission Control Protocol - DARPA Internet
  2588.    Program Protocol Specification", RFC 793, USC/Information Sciences
  2589.    Institute, NTIS AD Number A111091, September 1981.  Also in:
  2590.    Feinler, E. and J. Postel, eds., "Internet Protocol Transition
  2591.    Workbook", SRI International, Menlo Park, California, March 1982.
  2592.  
  2593. [HEADER-PEOPLE]
  2594.  
  2595. [RFC-DNS] P. Mockapetris, "Domain names - implementation and
  2596.       specification", RFC 1035 and P. Mockapetris, "Domain names -
  2597.       concepts and facilities", RFC 1034.  (STD 13)
  2598.  
  2599. [RFC 974] C. Partridge, "Mail routing and the domain system",  
  2600.       01/01/1986
  2601.  
  2602. [SMTPEX]  J. Klensin, N. Freed, M. Rose, E. Stefferud, D.
  2603.       Crocker, "SMTP Service Extensions", RFC-1869, 11/06/1995.
  2604.  
  2605. [RFC-1123] R. Braden, "Requirements for Internet hosts -
  2606.    application and support", 10/01/1989 
  2607.  
  2608. [RFC-MOSS]  S. Crocker, N. Freed, J. Galvin, S. Murphy, "MIME Object
  2609.    Security Services", RFC 1848, 10/03/1995.
  2610.  
  2611. [RFC-POP2] M. Butler, D. Chase, J. Goldberger, J. Postel, J.
  2612.      Reynolds, "Post Office Protocol - version 2", RFC 937,
  2613.      02/01/1985
  2614.  
  2615. [RFC-POP3]  J. Myers, M. Rose, "Post Office Protocol - Version 3",
  2616.    RFC 1725, 11/23/1994. 
  2617.  
  2618. [RFC-IMAP4] 1730  PS   M. Crispin, "Internet Message Access Protocol
  2619.    - Version 4", RFC 1730, 12/20/1994.
  2620.  
  2621.  
  2622. 8. Editor's Addresses
  2623.  
  2624.  John C. Klensin
  2625.  MCI Data Services
  2626.  800 Boylston St, 7th floor
  2627.  Boston, MA 02199
  2628.  USA
  2629.    Email: Klensin@mci.net
  2630.    Phone: +1 617 859 1011
  2631.    Fax:   +1 617 859 1011
  2632.  
  2633. ????
  2634.  
  2635.  
  2636. 9. Acknowledgements
  2637.  
  2638. <<to be supplied>> 
  2639.  
  2640.  
  2641. APPENDIX A
  2642.  
  2643. TCP Transport service
  2644.  
  2645. The Transmission Control Protocol [3] is used in the Internet, and in
  2646. any network following the Internet standards for internetwork protocols.
  2647.  
  2648. Connection Establishment
  2649.  
  2650.    The SMTP transmission channel is a TCP connection established
  2651.    between the sender process port U and the receiver process port
  2652.    L.  This single full duplex connection is used as the
  2653.    transmission channel.  This protocol is assigned the service
  2654.    port 25 (31 octal), that is L=25.
  2655.  
  2656. Data Transfer
  2657.  
  2658.    The TCP connection supports the transmission of 8-bit bytes.
  2659.    The SMTP data is 7-bit ASCII characters.  Each character is
  2660.    transmitted as an 8-bit byte with the high-order bit cleared to
  2661.    zero.
  2662.  
  2663.  
  2664. APPENDIX B
  2665.  
  2666. Generating SMTP commands from RFC 822 headers
  2667.  
  2668. Some systems use RFC 822 headers (only) in a mail submission
  2669. protocol, or otherwise generate SMTP commands from RFC 822 headers
  2670. when such a message is handed to an MTA from a UA.  While the MTA-UA
  2671. protocol is a private matter, not covered by any Internet Standard,
  2672. there are problems with this approach.  For example, there have been
  2673. repeated problems with proper handling of "bcc" copies and
  2674. redistribution lists when information that conceptually belongs to a
  2675. mail envelopes is not separated early in processing from header
  2676. information (and kept separate).  
  2677.  
  2678. It is recommended that the UA provide its initial MTA with an
  2679. envelope separate from the message itself.  However, if the envelope
  2680. is not supplied, SMTP commands should be generated as follows:
  2681.  
  2682. (i) each recipient addresses from a TO, CC, or BCC header field
  2683. should be copied to a RCPT command (generating multiple message
  2684. copies if that is required for queuing or delivery).  This includes
  2685. any addresses listed in a RFC 822 "group".  Any BCC fields should
  2686. then be removed from the headers.  Once this process is completed,
  2687. the remaining headers should be checked to verify that at least one
  2688. To:, Cc:, or Bcc: header remains.  If none do, then a bcc: header
  2689. with no additional information SHOULD be inserted (see section 2.15
  2690. below).
  2691.  
  2692. (ii) the return address in the MAIL command should be derived from
  2693. the system's identity for the submitting (local) user.  That return
  2694. address should also be copied to the Sender header field if it is
  2695. different from the address in the From header field.  (Any Sender
  2696. field that was already there should be removed.)  Systems may provide
  2697. a way for submitters to override the envelope return address, but may
  2698. want to restrict its use to privileged users.  (This will not prevent
  2699. mail forgery, but may lessen its incidence.)
  2700.  
  2701. A submission protocol based on Standard RFC 822 information alone
  2702. MUST NOT be used to gateway a message from a foreign (non-SMTP) mail
  2703. system into an SMTP environment.  Additional information to construct
  2704. an envelope must come from some source in the other environment,
  2705. whether supplemental headers or the foreign system's envelope.
  2706.  
  2707. Attempts to gateway messages using only their header "to" and "cc"
  2708. fields, have repeatedly caused mail loops and other behavior adverse
  2709. to the proper functioning of the Internet mail environment.  These
  2710. problems have been especially common when the message originates from
  2711. an Internet mailing list and is distributed into the foreign
  2712. environment using envelope information.  When these messages are then
  2713. processed by a header-only remailer, loops back to the Internet
  2714. environment (and the mailing list) are almost inevitable.
  2715.  
  2716.  
  2717. APPENDIX E
  2718.  
  2719. Theory of Reply Codes
  2720.  
  2721. The three digits of the reply each have a special significance.
  2722. The first digit denotes whether the response is good, bad or
  2723. incomplete.  An unsophisticated SMTP client will be able to
  2724. determine its next action (proceed as planned, redo, retrench,
  2725. etc.) by simply examining this first digit.  An SMTP client that
  2726. wants to know approximately what kind of error occurred (e.g.,
  2727. mail system error, command syntax error) may examine the second
  2728. digit, reserving the third digit for the finest gradation of
  2729. information.
  2730.  
  2731. There are five values for the first digit of the reply code:
  2732.  
  2733.   1yz   Positive Preliminary reply
  2734.  
  2735.      The command has been accepted, but the requested action
  2736.      is being held in abeyance, pending confirmation of the
  2737.      information in this reply.  The SMTP client should send
  2738.      another command specifying whether to continue or abort
  2739.      the action.
  2740.  
  2741.     [Note: SMTP does not have any commands that allow this
  2742.     type of reply, and so does not have the continue or
  2743.     abort commands.]
  2744.  
  2745.   2yz   Positive Completion reply
  2746.  
  2747.      The requested action has been successfully completed.  A
  2748.      new request may be initiated.
  2749.  
  2750.   3yz   Positive Intermediate reply
  2751.  
  2752.      The command has been accepted, but the requested action
  2753.      is being held in abeyance, pending receipt of further
  2754.      information.  The SMTP client should send another command
  2755.      specifying this information.  This reply is used in
  2756.      command sequence groups.
  2757.  
  2758.   4yz   Transient Negative Completion reply
  2759.  
  2760.      The command was not accepted and the requested action did
  2761.      not occur.  However, the error condition is temporary and
  2762.      the action may be requested again.  The sender should
  2763.      return to the beginning of the command sequence (if any).
  2764.      It is difficult to assign a meaning to "transient" when
  2765.      two different sites (receiver- and sender- SMTPs) must
  2766.      agree on the interpretation.  Each reply in this category
  2767.      might have a different time value, but the SMTP client is
  2768.      encouraged to try again.  A rule of thumb to determine if
  2769.      a reply fits into the 4yz or the 5yz category (see below)
  2770.      is that replies are 4yz if they can be repeated without
  2771.      any change in command form or in properties of the sender
  2772.      or receiver.  (E.g., the command is repeated identically
  2773.      and the receiver does not put up a new implementation.)
  2774.  
  2775.   5yz   Permanent Negative Completion reply
  2776.  
  2777.      The command was not accepted and the requested action did
  2778.      not occur.  The SMTP client is discouraged from repeating
  2779.      the exact request (in the same sequence).  Even some
  2780.      "permanent" error conditions can be corrected, so the
  2781.      human user may want to direct the SMTP client to
  2782.      reinitiate the command sequence by direct action at some
  2783.      point in the future (e.g., after the spelling has been
  2784.      changed, or the user has altered the account status).
  2785.  
  2786. The second digit encodes responses in specific categories:
  2787.  
  2788.   x0z   Syntax -- These replies refer to syntax errors,
  2789.     syntactically correct commands that don't fit any
  2790.     functional category, and unimplemented or superfluous
  2791.     commands.
  2792.  
  2793.   x1z   Information --  These are replies to requests for
  2794.     information, such as status or help.
  2795.  
  2796.   x2z   Connections -- These are replies referring to the
  2797.     transmission channel.
  2798.  
  2799.   x3z   Unspecified as yet.
  2800.  
  2801.   x4z   Unspecified as yet.
  2802.  
  2803.   x5z   Mail system -- These replies indicate the status of
  2804.     the receiver mail system vis-a-vis the requested
  2805.     transfer or other mail system action.
  2806.  
  2807. The third digit gives a finer gradation of meaning in each
  2808. category specified by the second digit.  The list of replies
  2809. illustrates this.  Each reply text is recommended rather than
  2810. mandatory, and may even change according to the command with
  2811. which it is associated.  On the other hand, the reply codes
  2812. must strictly follow the specifications in this section.
  2813. Receiver implementations should not invent new codes for
  2814. slightly different situations from the ones described here, but
  2815. rather adapt codes already defined.
  2816.  
  2817. For example, a command such as NOOP whose successful execution
  2818. does not offer the SMTP client any new information will return
  2819. a 250 reply.  The response is 502 when the command requests an
  2820. unimplemented non-site-specific action.  A refinement of that
  2821. is the 504 reply for a command that is implemented, but that
  2822. requests an unimplemented parameter.
  2823.  
  2824. The reply text may be longer than a single line; in these cases
  2825. the complete text must be marked so the SMTP client knows when it
  2826. can stop reading the reply.  This requires a special format to
  2827. indicate a multiple line reply.
  2828.  
  2829. The format for multiline replies requires that every line,
  2830. except the last, begin with the reply code, followed
  2831. immediately by a hyphen, "-" (also known as minus), followed by
  2832. text.  The last line will begin with the reply code, followed
  2833. immediately by <SP>, optionally some text, and <CRLF>.
  2834.  
  2835.   For example:
  2836.               123-First line
  2837.               123-Second line
  2838.               123-234 text beginning with numbers
  2839.               123 The last line
  2840.  
  2841. In many cases the SMTP client then simply needs to search for
  2842. the reply code followed by <SP> at the beginning of a line, and
  2843. ignore all preceding lines.  In a few cases, there is important
  2844. data for the sender in the reply "text".  The sender will know
  2845. these cases from the current context.
  2846.  
  2847.  
  2848. APPENDIX F
  2849.  
  2850. Scenarios
  2851.  
  2852. This section presents complete scenarios of several types of SMTP
  2853. sessions.
  2854.  
  2855. A Typical SMTP Transaction Scenario
  2856.  
  2857. This SMTP example shows mail sent by Smith at host USC-ISIF, to
  2858. Jones, Green, and Brown at host BBN-UNIX.  Here we assume that
  2859. host USC-ISIF contacts host BBN-UNIX directly.  The mail is
  2860. accepted for Jones and Brown.  Green does not have a mailbox at
  2861. host BBN-UNIX.
  2862.  
  2863. -------------------------------------------------------------
  2864.  
  2865.    R: 220 BBN-UNIX.ARPA Simple Mail Transfer Service Ready
  2866.    S: HELO USC-ISIF.ARPA
  2867.    R: 250 BBN-UNIX.ARPA
  2868.  
  2869.    S: MAIL FROM:<Smith@USC-ISIF.ARPA>
  2870.    R: 250 OK
  2871.  
  2872.    S: RCPT TO:<Jones@BBN-UNIX.ARPA>
  2873.    R: 250 OK
  2874.  
  2875.    S: RCPT TO:<Green@BBN-UNIX.ARPA>
  2876.    R: 550 No such user here
  2877.  
  2878.    S: RCPT TO:<Brown@BBN-UNIX.ARPA>
  2879.    R: 250 OK
  2880.  
  2881.    S: DATA
  2882.    R: 354 Start mail input; end with <CRLF>.<CRLF>
  2883.    S: Blah blah blah...
  2884.    S: ...etc. etc. etc.
  2885.    S: .
  2886.    R: 250 OK
  2887.  
  2888.    S: QUIT
  2889.    R: 221 BBN-UNIX.ARPA Service closing transmission channel
  2890.  
  2891.              Scenario 1
  2892.  
  2893. -------------------------------------------------------------
  2894.  
  2895.  
  2896.  
  2897.  
  2898.  
  2899. Aborted SMTP Transaction Scenario
  2900.  
  2901. -------------------------------------------------------------
  2902.  
  2903.    R: 220 MIT-Multics.ARPA Simple Mail Transfer Service Ready
  2904.    S: HELO ISI-VAXA.ARPA
  2905.    R: 250 MIT-Multics.ARPA
  2906.  
  2907.    S: MAIL FROM:<Smith@ISI-VAXA.ARPA>
  2908.    R: 250 OK
  2909.  
  2910.    S: RCPT TO:<Jones@MIT-Multics.ARPA>
  2911.    R: 250 OK
  2912.  
  2913.    S: RCPT TO:<Green@MIT-Multics.ARPA>
  2914.    R: 550 No such user here
  2915.  
  2916.    S: RSET
  2917.    R: 250 OK
  2918.  
  2919.    S: QUIT
  2920.    R: 221 MIT-Multics.ARPA Service closing transmission channel
  2921.  
  2922.              Scenario 2
  2923.  
  2924. -------------------------------------------------------------
  2925.  
  2926.  
  2927.  
  2928. Relayed Mail Scenario
  2929.  
  2930. -------------------------------------------------------------
  2931.  
  2932.    Step 1  --  Source Host to Relay Host
  2933.  
  2934.       R: 220 USC-ISIE.ARPA Simple Mail Transfer Service Ready
  2935.       S: HELO MIT-AI.ARPA
  2936.       R: 250 USC-ISIE.ARPA
  2937.  
  2938.       S: MAIL FROM:<JQP@MIT-AI.ARPA>
  2939.       R: 250 OK
  2940.  
  2941.       S: RCPT TO:<@USC-ISIE.ARPA:Jones@BBN-VAX.ARPA>
  2942.       R: 250 OK
  2943.  
  2944.       S: DATA
  2945.       R: 354 Start mail input; end with <CRLF>.<CRLF>
  2946.       S: Date: 2 Nov 81 22:33:44
  2947.       S: From: John Q. Public <JQP@MIT-AI.ARPA>
  2948.       S: Subject:  The Next Meeting of the Board
  2949.       S: To: Jones@BBN-Vax.ARPA
  2950.       S:
  2951.       S: Bill:
  2952.       S: The next meeting of the board of directors will be
  2953.       S: on Tuesday.
  2954.       S:                                              John.
  2955.       S: .
  2956.       R: 250 OK
  2957.  
  2958.       S: QUIT
  2959.       R: 221 USC-ISIE.ARPA Service closing transmission channel
  2960.  
  2961.  
  2962.    Step 2  --  Relay Host to Destination Host
  2963.  
  2964.       R: 220 BBN-VAX.ARPA Simple Mail Transfer Service Ready
  2965.       S: HELO USC-ISIE.ARPA
  2966.       R: 250 BBN-VAX.ARPA
  2967.  
  2968.       S: MAIL FROM:<@USC-ISIE.ARPA:JQP@MIT-AI.ARPA>
  2969.       R: 250 OK
  2970.  
  2971.       S: RCPT TO:<Jones@BBN-VAX.ARPA>
  2972.       R: 250 OK
  2973.  
  2974.       S: DATA
  2975.       R: 354 Start mail input; end with <CRLF>.<CRLF>
  2976.       S: Received: from MIT-AI.ARPA by USC-ISIE.ARPA ;
  2977.      2 Nov 81 22:40:10 UT
  2978.       S: Date: 2 Nov 81 22:33:44
  2979.       S: From: John Q. Public <JQP@MIT-AI.ARPA>
  2980.       S: Subject:  The Next Meeting of the Board
  2981.       S: To: Jones@BBN-Vax.ARPA
  2982.       S:
  2983.       S: Bill:
  2984.       S: The next meeting of the board of directors will be
  2985.       S: on Tuesday.
  2986.       S:                                              John.
  2987.       S: .
  2988.       R: 250 OK
  2989.  
  2990.       S: QUIT
  2991.       R: 221 USC-ISIE.ARPA Service closing transmission channel
  2992.  
  2993.              Scenario 3
  2994.  
  2995. -------------------------------------------------------------
  2996.  
  2997.  
  2998.  
  2999.  
  3000. Verifying and Sending Scenario
  3001.  
  3002. -------------------------------------------------------------
  3003.  
  3004.    R: 220 SU-SCORE.ARPA Simple Mail Transfer Service Ready
  3005.    S: HELO MIT-MC.ARPA
  3006.    R: 250 SU-SCORE.ARPA
  3007.  
  3008.    S: VRFY Crispin
  3009.    R: 250 Mark Crispin <Admin.MRC@SU-SCORE.ARPA>
  3010.  
  3011.    S: SEND FROM:<EAK@MIT-MC.ARPA>
  3012.    R: 250 OK
  3013.  
  3014.    S: RCPT TO:<Admin.MRC@SU-SCORE.ARPA>
  3015.    R: 250 OK
  3016.  
  3017.    S: DATA
  3018.    R: 354 Start mail input; end with <CRLF>.<CRLF>
  3019.    S: Blah blah blah...
  3020.    S: ...etc. etc. etc.
  3021.    S: .
  3022.    R: 250 OK
  3023.  
  3024.    S: QUIT
  3025.    R: 221 SU-SCORE.ARPA Service closing transmission channel
  3026.  
  3027.              Scenario 4
  3028.  
  3029. -------------------------------------------------------------
  3030.  
  3031.  
  3032.  
  3033.  
  3034. Mailing List Scenario
  3035.  
  3036. First each of two mailing lists are expanded in separate sessions
  3037. with different hosts.  Then the message is sent to everyone that
  3038. appeared on either list (but no duplicates) via a relay host.
  3039.  
  3040. -------------------------------------------------------------
  3041.  
  3042.    Step 1  --  Expanding the First List
  3043.  
  3044.       R: 220 MIT-AI.ARPA Simple Mail Transfer Service Ready
  3045.       S: HELO SU-SCORE.ARPA
  3046.       R: 250 MIT-AI.ARPA
  3047.  
  3048.       S: EXPN Example-People
  3049.       R: 250-<ABC@MIT-MC.ARPA>
  3050.       R: 250-Fred Fonebone <Fonebone@USC-ISIQ.ARPA>
  3051.       R: 250-Xenon Y. Zither <XYZ@MIT-AI.ARPA>
  3052.       R: 250-Quincy Smith <@USC-ISIF.ARPA:Q-Smith@ISI-VAXA.ARPA>
  3053.       R: 250-<joe@foo-unix.ARPA>
  3054.       R: 250 <xyz@bar-unix.ARPA>
  3055.  
  3056.       S: QUIT
  3057.       R: 221 MIT-AI.ARPA Service closing transmission channel
  3058.  
  3059.  
  3060.    Step 2  --  Expanding the Second List
  3061.  
  3062.       R: 220 MIT-MC.ARPA Simple Mail Transfer Service Ready
  3063.       S: HELO SU-SCORE.ARPA
  3064.       R: 250 MIT-MC.ARPA
  3065.  
  3066.       S: EXPN Interested-Parties
  3067.       R: 250-Al Calico <ABC@MIT-MC.ARPA>
  3068.       R: 250-<XYZ@MIT-AI.ARPA>
  3069.       R: 250-Quincy Smith <@USC-ISIF.ARPA:Q-Smith@ISI-VAXA.ARPA>
  3070.       R: 250-<fred@BBN-UNIX.ARPA>
  3071.       R: 250 <xyz@bar-unix.ARPA>
  3072.  
  3073.       S: QUIT
  3074.       R: 221 MIT-MC.ARPA Service closing transmission channel
  3075.  
  3076.  
  3077.    Step 3  --  Mailing to All via a Relay Host
  3078.  
  3079.       R: 220 USC-ISIE.ARPA Simple Mail Transfer Service Ready
  3080.       S: HELO SU-SCORE.ARPA
  3081.       R: 250 USC-ISIE.ARPA
  3082.  
  3083.       S: MAIL FROM:<Account.Person@SU-SCORE.ARPA>
  3084.       R: 250 OK
  3085.       S: RCPT TO:<@USC-ISIE.ARPA:ABC@MIT-MC.ARPA>
  3086.       R: 250 OK
  3087.       S: RCPT TO:<@USC-ISIE.ARPA:Fonebone@USC-ISIQA.ARPA>
  3088.       R: 250 OK
  3089.       S: RCPT TO:<@USC-ISIE.ARPA:XYZ@MIT-AI.ARPA>
  3090.       R: 250 OK
  3091.       S: RCPT
  3092.       TO:<@USC-ISIE.ARPA,@USC-ISIF.ARPA:Q-Smith@ISI-VAXA.ARPA>
  3093.       R: 250 OK
  3094.       S: RCPT TO:<@USC-ISIE.ARPA:joe@FOO-UNIX.ARPA>
  3095.       R: 250 OK
  3096.       S: RCPT TO:<@USC-ISIE.ARPA:xyz@BAR-UNIX.ARPA>
  3097.       R: 250 OK
  3098.       S: RCPT TO:<@USC-ISIE.ARPA:fred@BBN-UNIX.ARPA>
  3099.       R: 250 OK
  3100.  
  3101.       S: DATA
  3102.       R: 354 Start mail input; end with <CRLF>.<CRLF>
  3103.       S: Blah blah blah...
  3104.       S: ...etc. etc. etc.
  3105.       S: .
  3106.       R: 250 OK
  3107.  
  3108.       S: QUIT
  3109.       R: 221 USC-ISIE.ARPA Service closing transmission channel
  3110.  
  3111.              Scenario 7
  3112.  
  3113. -------------------------------------------------------------
  3114.  
  3115.  
  3116.  
  3117. Too Many Recipients Scenario
  3118.  
  3119. -------------------------------------------------------------
  3120.  
  3121.    R: 220 BERKELEY.ARPA Simple Mail Transfer Service Ready
  3122.    S: HELO USC-ISIF.ARPA
  3123.    R: 250 BERKELEY.ARPA
  3124.  
  3125.    S: MAIL FROM:<Postel@USC-ISIF.ARPA>
  3126.    R: 250 OK
  3127.  
  3128.    S: RCPT TO:<fabry@BERKELEY.ARPA>
  3129.    R: 250 OK
  3130.  
  3131.    S: RCPT TO:<eric@BERKELEY.ARPA>
  3132.    R: 552 Recipient storage full, try again in another transaction
  3133.  
  3134.    S: DATA
  3135.    R: 354 Start mail input; end with <CRLF>.<CRLF>
  3136.    S: Blah blah blah...
  3137.    S: ...etc. etc. etc.
  3138.    S: .
  3139.    R: 250 OK
  3140.  
  3141.    S: MAIL FROM:<Postel@USC-ISIF.ARPA>
  3142.    R: 250 OK
  3143.  
  3144.    S: RCPT TO:<eric@BERKELEY.ARPA>
  3145.    R: 250 OK
  3146.  
  3147.    S: DATA
  3148.    R: 354 Start mail input; end with <CRLF>.<CRLF>
  3149.    S: Blah blah blah...
  3150.    S: ...etc. etc. etc.
  3151.    S: .
  3152.    R: 250 OK
  3153.  
  3154.    S: QUIT
  3155.    R: 221 BERKELEY.ARPA Service closing transmission channel
  3156.  
  3157.             Scenario 10
  3158.  
  3159. -------------------------------------------------------------
  3160.  
  3161. Note that a real implementation must handle many recipients as
  3162. specified in Section 4.5.3.
  3163.  
  3164.  
  3165. APPENDIX G  Other gateway issues.
  3166.  
  3167. In general, gateways between the Internet and other mail systems
  3168. SHOULD attempt to preserve any layering semantics across the
  3169. boundaries between the two mail systems involved.  Gateway-
  3170. translation approaches that attempt to take shortcuts by
  3171. mapping, e.g., envelope information from one system to the
  3172. message headers or body of another have generally proven to be
  3173. inadequate in important ways.   Systems translating between
  3174. environments that do not support both envelopes and headers and
  3175. Internet mail must be written with the understanding that some
  3176. information loss is almost inevitable.
  3177.  
  3178.  
  3179.  
  3180.  
  3181. APPENDIX H  GLOSSARY
  3182.  
  3183. ASCII
  3184.  
  3185. American Standard Code for Information Interchange [1].
  3186.  
  3187. command
  3188.  
  3189. A request for a mail service action sent by the SMTP client to the
  3190. SMTP server.
  3191.  
  3192. domain
  3193.  
  3194. The hierarchially structured global character string address of a
  3195. host computer in the mail system.
  3196.  
  3197. end of mail data indication
  3198.  
  3199. A special sequence of characters that indicates the end of the
  3200. mail data.  In particular, the five characters carriage return,
  3201. line feed, period, carriage return, line feed, in that order.
  3202.  
  3203. host
  3204.  
  3205. A computer in the internetwork environment on which mailboxes or
  3206. SMTP processes reside.
  3207.  
  3208. line
  3209.  
  3210. A a sequence of ASCII characters ending with a <CRLF>.
  3211.  
  3212. mail data
  3213.  
  3214. A sequence of ASCII characters of arbitrary length, which conforms
  3215. to the standard set in the Standard for the Format of ARPA
  3216. Internet Text Messages (RFC 822 [RFC822]).
  3217.  
  3218. mailbox
  3219.  
  3220. A character string (address) which identifies a user to whom mail
  3221. is to be sent.  Mailbox normally consists of the host and user
  3222. specifications.  The standard mailbox naming convention is defined
  3223. to be "user@domain".  Additionally, the "container" in which mail
  3224. is stored.
  3225.  
  3226.  
  3227. SMTP server process
  3228.  
  3229. A process which transfers mail in cooperation with an SMTP client
  3230. process.  It waits for a connection to be established via the
  3231. transport service.  It receives SMTP commands from the
  3232. SMTP client, sends replies, and performs the specified operations.
  3233.  
  3234. reply
  3235.  
  3236. A reply is an acknowledgment (positive or negative) sent from
  3237. receiver to sender via the transmission channel in response to a
  3238. command.  The general form of a reply is a completion code
  3239. (including error codes) followed by a text string.  The codes are
  3240. for use by programs and the text is usually intended for human
  3241. users.
  3242.  
  3243. SMTP client process
  3244.  
  3245. A process which transfers mail in cooperation with an SMTP server
  3246. process.  A local language may be used in the user interface
  3247. command/reply dialogue.  The SMTP client initiates the transport
  3248. service connection.  It initiates SMTP commands, receives replies,
  3249. and governs the transfer of mail.
  3250.  
  3251. session
  3252.  
  3253. The set of exchanges that occur while the transmission channel is
  3254. open.
  3255.  
  3256. transaction
  3257.  
  3258. The set of exchanges required for one message to be transmitted
  3259. for one or more recipients.
  3260.  
  3261. transmission channel
  3262.  
  3263. A full-duplex communication path between an SMTP client and a
  3264. SMTP server for the exchange of commands, replies, and mail
  3265. text.
  3266.  
  3267. transport service
  3268.  
  3269. Any reliable stream-oriented data communication services.  For
  3270. example, NCP, TCP, NITS.
  3271.  
  3272.  
  3273. user
  3274.  
  3275. A human being (or a process on behalf of a human being) wishing to
  3276. obtain mail transfer service.  In addition, a recipient of
  3277. computer mail.
  3278.  
  3279. word
  3280.  
  3281. A sequence of printing characters.
  3282.  
  3283. <CRLF>
  3284.  
  3285. The characters carriage return and line feed (in that order).
  3286.  
  3287. <SP>
  3288.  
  3289. The space character.
  3290.  
  3291.  
  3292.  
  3293.  
  3294.  
  3295. --------------------------------------------------
  3296.  
  3297.  What to do with the following... ??
  3298.  
  3299. ??.??.?? Time semantics
  3300.  
  3301.    The Date specified in the RFC 822 header is normally presumed
  3302.    to be the date and time at which the user completed
  3303.    composition of the message.  As such, it SHOULD be supplied by
  3304.    the message composing system.  An SMTP server MUST NOT alter
  3305.    this date if it appears in a message received by it for 
  3306.    transmission or relaying.  
  3307.  
  3308.    In environments in which mail composition agents queue mail
  3309.    locally before transmitting it to a sending SMTP server (or
  3310.    the other component of a split-MUA arrangement), the RFC 822
  3311.    date SHOULD reflect the time at which message composition was 
  3312.    completed, not the time of transfer to the MTA.
  3313.  
  3314.    In environments in which Mail User Agent/ Mail Transfer Agent
  3315.    distinctions are made, SMTP servers normally SHOULD insert a
  3316.    Received field to reflect the receipt of the message for
  3317.    transmission from the MUA.
  3318.  
  3319. APPENDIX X: Change summary and Loose ends (temporary)
  3320.  
  3321. X.1 Change summary
  3322.  
  3323. X.1.1 Substantive changes between draft-ietf-drums-smtpupd-00.txt and
  3324. draft-ietf-drums-smtpupd-01.txt 
  3325.  
  3326. (i) Slightly clarified the discussions of rejection and failure of
  3327. VRFY requests and the associated response codes.
  3328.  
  3329. (ii) Slightly clarified the discussion of deferred address
  3330. validation. 
  3331.  
  3332. (iii) Removed the IPCE terminology and modified the text in section
  3333. 4.1.1.2 to explicitly introduce the "mail gateway" terminology and to
  3334. begin to distinguish a mail gateway from a conventional relay.
  3335. **Please Review This Text**.
  3336.  
  3337. (iv) Explicitly noted that SMTP clients for things like POP and IMAP
  3338. may send everything to a single relay for further processing, rather
  3339. than resolving final domain names.
  3340.  
  3341. (v) Tightened the RSET discussion.
  3342.  
  3343. (vi) Deprecation of 251 only for RCPT (still ok for VRFY)
  3344.  
  3345.  
  3346. X.2 Loose ends
  3347.  
  3348. (i) Material in RFC1123, section 5.2.6, not yet fully incorporated.
  3349.  
  3350. (ii) The following text needs to go in somewhere in some form.
  3351.      Please note that, when RFC 822 format is being used, the mail data
  3352.      includes the memo header items such as Date, Subject, To, Cc, From
  3353.      [RFC822].  Server SMTP systems SHOULD NOT reject messages based on
  3354.      perceived defects in the RFC 822 or MIME [MIME] message header or
  3355.      message body.  In particular, they MUST NOT reject messages on the
  3356.      basis of trying to match numbers of Resent- fields.  In particular,
  3357.      messages MUST NOT be rejected because Resent-to appears without
  3358.      Resent-from, Resent-date, or both. 
  3359.  
  3360. (iii) Are 5.3.3 and 5.3.4 of RFC1123 adequately incorporated?
  3361.  
  3362. (iv) What needs to be done about RFC1123 5.3.6 and 5.3.7 and where
  3363. should it/they go?
  3364.  
  3365.