home *** CD-ROM | disk | FTP | other *** search
/ Unix System Administration Handbook 1997 October / usah_oct97.iso / rfc / 700s / rfc788.txt < prev    next >
Text File  |  1992-10-14  |  109KB  |  3,698 lines

  1. RFC788
  2.                                                                         
  3.  
  4.                                     
  5.                                     
  6.                                     
  7.                                     
  8.                                     
  9.                      SIMPLE MAIL TRANSFER PROTOCOL
  10.                                     
  11.                                     
  12.                                     
  13.                            Jonathan B. Postel
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.                              November 1981
  45.                                     
  46.                                     
  47.                                     
  48.                      Information Sciences Institute
  49.                    University of Southern California
  50.                            4676 Admiralty Way
  51.                    Marina del Rey, California  90291
  52.  
  53.                              (213) 822-1511
  54.  
  55.                                                                         
  56. RFC 788                                                    November 1981
  57.                                            Simple Mail Transfer Protocol
  58.  
  59.  
  60.  
  61.                            TABLE OF CONTENTS
  62.  
  63.    1.  INTRODUCTION .................................................. 1
  64.  
  65.    2.  THE SMTP MODEL ................................................ 2
  66.  
  67.    3.  THE SMTP PROCEDURE ............................................ 4
  68.  
  69.       3.1.  Mail ..................................................... 4
  70.       3.2.  Forwarding ............................................... 7
  71.       3.3.  Verifying and Expanding .................................. 8
  72.       3.4.  Sending and Mailing ..................................... 10
  73.       3.5.  Opening and Closing ..................................... 12
  74.       3.6.  Relaying ................................................ 13
  75.       3.7.  Domains ................................................. 15
  76.  
  77.    4.  THE SMTP SPECIFICATIONS ...................................... 16
  78.  
  79.       4.1.  SMTP Commands ........................................... 16
  80.       4.1.1.  Command Semantics ..................................... 16
  81.       4.1.2.  Command Syntax ........................................ 23
  82.       4.2.  SMTP Replies ............................................ 28
  83.       4.2.1.  Reply Codes by Function Group ......................... 29
  84.       4.2.2.  Reply Codes in Numeric Order .......................... 30
  85.       4.3.  Sequencing of Commands and Replies ...................... 31
  86.       4.4.  State Diagrams .......................................... 33
  87.       4.5.  Details ................................................. 35
  88.       4.5.1.  Minimum Implementation ................................ 35
  89.       4.5.2.  Transparency .......................................... 35
  90.       4.5.3.  Sizes ................................................. 36
  91.  
  92.    APPENDIX A:  TCP ................................................. 38
  93.    APPENDIX B:  NCP ................................................. 39
  94.    APPENDIX C:  NITS ................................................ 40
  95.    APPENDIX D:  X.25 ................................................ 41
  96.    APPENDIX E:  Theory of Reply Codes ............................... 42
  97.    APPENDIX F:  Scenarios ........................................... 45
  98.  
  99.    GLOSSARY ......................................................... 58
  100.  
  101.    REFERENCES ....................................................... 61
  102.  
  103.  
  104. Network Working Group                                          J. Postel
  105. Request for Comments: 788                                            ISI
  106. Replaces: RFC 780, 772                                     November 1981
  107.  
  108.                      SIMPLE MAIL TRANSFER PROTOCOL
  109.  
  110.  
  111. 1.  INTRODUCTION
  112.  
  113.    The objective of Simple Mail Transfer Protocol (SMTP) is to transfer
  114.    mail reliably and efficiently.
  115.  
  116.    SMTP is independent of the particular transmission subsystem and
  117.    requires only a reliable ordered data stream channel.  Appendices A,
  118.    B, C, and D describe the use of SMTP with various transport services.
  119.    A Glossary provides the definitions of terms as used in this
  120.    document.
  121.  
  122.    An important feature of SMTP is its capability to relay mail across
  123.    transport service environments.  A transport service provides an
  124.    interprocess communication environment (IPCE).  An IPCE may cover one
  125.    network, several networks, or a subset of a network.  It is important
  126.    to realize that transport systems (or IPCEs) are not one-to-one with
  127.    networks.  A process can communicate directly with another process
  128.    through any mutually known IPCE.  Mail is an application or use of
  129.    interprocess communication.  Mail can be communicated between
  130.    processes in different IPCEs by relaying through a process connected
  131.    to two (or more) IPCEs.  More specifically, mail can be relayed
  132.    between hosts on different transport systems by a host on both
  133.    transport systems.
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158. Postel                                                          [Page 1]
  159.  
  160.  
  161.                                                                         
  162. November 1981                                                    RFC 788
  163. Simple Mail Transfer Protocol                                           
  164.  
  165.  
  166.  
  167. 2.  THE SMTP MODEL
  168.  
  169.    The SMTP design is based on the following model of communication:  as
  170.    the result of a user mail request, the sender-SMTP establishes a
  171.    full-duplex transmission channel to a receiver-SMTP.  The
  172.    receiver-SMTP may be either the ultimate destination or an
  173.    intermediate.  SMTP commands are generated by the sender-SMTP and
  174.    sent to the receiver-SMTP.  SMTP replies are sent from the
  175.    receiver-SMTP to the sender-SMTP in response to the commands.
  176.  
  177.    Once the transmission channel is established, the SMTP-sender sends a
  178.    MAIL command indicating the sender of the mail.  If the SMTP-receiver
  179.    can accept mail it responds with an OK reply.  The SMTP-sender then
  180.    sends a RCPT command identifying a recipient of the mail.  If the
  181.    SMTP-receiver can accept mail for that recipient it responds with an
  182.    OK reply; if not, it responds with a reply rejecting that recipient
  183.    (but not the whole mail transaction).  The SMTP-sender and
  184.    SMTP-receiver may negotiate several recipients.  When the recipients
  185.    have been negotiated the SMTP-sender sends the mail data, terminating
  186.    with a special sequence.  If the SMTP-receiver successfully processes
  187.    the mail data it responds with an OK reply.  The dialog is purposely
  188.    lock-step, one-at-a-time.
  189.  
  190.      -------------------------------------------------------------
  191.  
  192.    
  193.                +----------+                +----------+
  194.    +------+    |          |                |          |
  195.    | User |<-->|          |      SMTP      |          |
  196.    +------+    |  Sender- |Commands/Replies| Receiver-|
  197.    +------+    |   SMTP   |<-------------->|    SMTP  |    +------+
  198.    | File |<-->|          |    and Mail    |          |<-->| File |
  199.    |System|    |          |                |          |    |System|
  200.    +------+    +----------+                +----------+    +------+
  201.    
  202.  
  203.                 Sender-SMTP                Receiver-SMTP
  204.  
  205.                            Model for SMTP Use
  206.  
  207.                                 Figure 1
  208.  
  209.      -------------------------------------------------------------
  210.  
  211.    The SMTP provides mechanisms for the transmission of mail; directly
  212.    from the sending user's host to the receiving user's host when the
  213.  
  214.  
  215.  
  216. [Page 2]                                                          Postel
  217.  
  218.  
  219.                                                                         
  220. RFC 788                                                    November 1981
  221.                                            Simple Mail Transfer Protocol
  222.  
  223.  
  224.  
  225.    two host are connected to the same transport service, or via one or
  226.    more relay SMTP-servers when the source and destination hosts are not
  227.    connected to the same transport service.
  228.  
  229.    To be able to provide the relay capability the SMTP-server must be
  230.    supplied with the name of the ultimate destination host as well as
  231.    the destination mailbox name.
  232.  
  233.    The argument to the MAIL command is a reverse-path, which specifies
  234.    who the mail is from.  The argument to the RCPT command is a
  235.    forward-path, which specifies who the mail is to.  The forward-path
  236.    is a source route while the reverse-path, is a return route (which
  237.    may be used to return a message to the sender when an error occurs
  238.    with a relayed message).
  239.  
  240.    When the same message is sent to multiple recipients the SMTP
  241.    encourages the transmission of only one copy of the data for all the
  242.    recipients at the same destination host.
  243.  
  244.    The mail commands and replies have a rigid syntax.  Replies also have
  245.    a numeric code.  In the following, examples appear which use actual
  246.    commands and replies.  The complete lists of commands and replies
  247.    appears in Section 4 on specifications.
  248.  
  249.    Commands and replies are not case sensitive.  That is, a command or
  250.    reply word may be upper case, lower case, or any mixture of upper and
  251.    lower case.  Note that this is not true of mailbox user names.  For
  252.    some hosts the user name is case sensitive, and SMTP implementations
  253.    must take case to preserve the case of user names as they appear in
  254.    mailbox arguments.  Host names are not case sensitive.
  255.  
  256.    Commands and replies are composed of characters from the ASCII
  257.    character set [1].  Each 7-bit character is transmitted right
  258.    justified in an 8-bit byte (or octet) with the high order bit cleared
  259.    to zero.
  260.  
  261.    When specifying the general form of a command or reply, an argument
  262.    (or special symbol) will be denoted by a meta-linguistic variable (or
  263.    constant), for example, "<string>" or "<reverse-path>".  Here the
  264.    angle brackets indicate these are a meta-linguistic variables.
  265.    However, some arguments use the angle brackets literally.  For
  266.    example, an actual reverse-path is enclosed in angle brackets, i.e.,
  267.    "<Smith@ISIA>" is an instance of <reverse-path> (the angle brackets
  268.    are actually transmitted in the command or reply).
  269.  
  270.  
  271.  
  272.  
  273.  
  274. Postel                                                          [Page 3]
  275.  
  276.  
  277.                                                                         
  278. November 1981                                                    RFC 788
  279. Simple Mail Transfer Protocol                                           
  280.  
  281.  
  282.  
  283. 3.  THE SMTP PROCEDURES
  284.  
  285.    This section presents the procedures used in SMTP in several parts.
  286.    First comes the basic mail procedure defined as a mail transaction.
  287.    Following this are descriptions of forwarding mail, verifying mailbox
  288.    names and expanding mailing lists, sending to terminals instead of or
  289.    in combination with mailboxes, and the opening and closing exchanges.
  290.    At the end of this section are comments on relaying, and a note on
  291.    mail domains.  Throughout this section are examples of partial
  292.    command and reply sequences, several complete scenarios are presented
  293.    in Appendix F.
  294.  
  295.    3.1.  MAIL
  296.  
  297.       There are three steps to a SMTP mail transaction.  The transaction
  298.       is started with a MAIL command which gives the sender
  299.       identification.  A series of one or more RCPT commands follow
  300.       giving the receiver information.  Then a DATA command gives the
  301.       mail data.  And finally, the end of mail data indicator confirms
  302.       the transaction.
  303.  
  304.          The first step in the procedure is the MAIL command.  The
  305.          <reverse-path> contains the source mailbox.
  306.  
  307.             MAIL <SP> FROM:<reverse-path> <CRLF>
  308.  
  309.          This command tells the the SMTP-receiver that a new mail
  310.          transaction is starting and to reset all its state tables and
  311.          buffers including any recipients or mail data.  It gives the
  312.          reverse-path which can be used to report errors.  If accepted,
  313.          the receiver-SMTP returns a 250 OK reply.
  314.  
  315.          The <reverse-path> can contain more than just a mailbox.  The
  316.          <reverse-path> is a reverse source routing list of hosts and
  317.          source mailbox.  The first host in the <reverse-path> should be
  318.          the host sending this command.
  319.  
  320.          The second step in the procedure is the RCPT command.
  321.  
  322.             RCPT <SP> TO:<forward-path> <CRLF>
  323.  
  324.          This command gives a forward-path identifying one recipient.
  325.          If accepted, the receiver-SMTP returns a 250 OK reply, and
  326.          stores the forward-path.  If the recipient is unknown the
  327.          receiver-SMTP returns a 550 Failure reply.  This second step of
  328.          the procedure can be repeated any number of times.
  329.  
  330.  
  331.  
  332. [Page 4]                                                          Postel
  333.  
  334.  
  335.                                                                         
  336. RFC 788                                                    November 1981
  337.                                            Simple Mail Transfer Protocol
  338.  
  339.  
  340.  
  341.          The <forward-path> can contain more than just a mailbox.  The
  342.          <forward-path> is a source routing list of hosts and
  343.          destination mailbox.  The first host in the <forward-path>
  344.          should be the host receiving this command.
  345.  
  346.          The third step in the procedure is the DATA command.
  347.  
  348.             DATA <CRLF>
  349.  
  350.          If accepted, the receiver-SMTP returns a 354 Intermediate reply
  351.          and considers all succeeding lines to be the message text.
  352.          When the end of text is received and stored the SMTP-receiver
  353.          sends a 250 OK reply.
  354.  
  355.          Since the mail data is sent on the transmission channel the end
  356.          of the mail data must be indicated so that the command and
  357.          reply dialog can be resumed.  SMTP indicates the end of the
  358.          mail data by sending a line containing only a period.  A
  359.          transparency procedure is used to prevent this interfering with
  360.          the user's text (see Section 4.5.2).
  361.  
  362.             Please note that the mail data includes the memo header
  363.             items such as Date, Subject, To, Cc, From [2].
  364.  
  365.          The end of mail data indicator also confirms the mail
  366.          transaction and tells the receiver-SMTP to now process the
  367.          stored recipients and mail data.  If accepted, the
  368.          receiver-SMTP returns a 250 OK reply.  The DATA command should
  369.          fail only if the mail transaction was incomplete (for example,
  370.          no recipients), or if resources are not available.
  371.  
  372.       The above procedure is an example of a SMTP mail transaction.
  373.       These commands must be used only in the order discussed above.
  374.       Example 1 (below) illustrates the use of these commands in a mail
  375.       transaction.
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390. Postel                                                          [Page 5]
  391.  
  392.  
  393.                                                                         
  394. November 1981                                                    RFC 788
  395. Simple Mail Transfer Protocol                                           
  396.  
  397.  
  398.  
  399.       -------------------------------------------------------------
  400.  
  401.                      Example of the SMTP Procedure
  402.  
  403.          This SMTP example shows mail sent by Smith at host Alpha, to
  404.          Jones, Green, and Brown at host Beta.  Here we assume that host
  405.          Alpha contacts host Beta directly.
  406.  
  407.             S: MAIL FROM:<Smith@Alpha>
  408.             R: 250 OK
  409.  
  410.             S: RCPT TO:<Jones@Beta>
  411.             R: 250 OK
  412.  
  413.             S: RCPT TO:<Green@Beta>
  414.             R: 550 No such user here
  415.  
  416.             S: RCPT TO:<Brown@Beta>
  417.             R: 250 OK
  418.  
  419.             S: DATA
  420.             R: 354 Start mail input; end with <CRLF>.<CRLF>
  421.             S: Blah blah blah...
  422.             S: ...etc. etc. etc.
  423.             S: <CRLF>.<CRLF>
  424.             R: 250 OK
  425.  
  426.          The mail has now been accepted for Jones and Brown.  Green did
  427.          not have a mailbox at host Beta.
  428.  
  429.                                Example 1
  430.  
  431.       -------------------------------------------------------------
  432.  
  433.  
  434.  
  435.  
  436.  
  437.  
  438.  
  439.  
  440.  
  441.  
  442.  
  443.  
  444.  
  445.  
  446.  
  447.  
  448. [Page 6]                                                          Postel
  449.  
  450.  
  451.                                                                         
  452. RFC 788                                                    November 1981
  453.                                            Simple Mail Transfer Protocol
  454.  
  455.  
  456.  
  457.    3.2.  FORWARDING
  458.  
  459.       There are some cases where the destination information in the
  460.       <forward-path> is incorrect, but the receiver-SMTP knows the
  461.       correct destination.  In such cases, one the following replies
  462.       should be used to allow the sender to contact the correct
  463.       destination.
  464.  
  465.          251 User not local; will forward to <forward-path>
  466.  
  467.             This reply indicates that the receiver-SMTP knows the user's
  468.             mailbox is on another host and indicates the correct
  469.             forward-path to use in the future.  Note that either the
  470.             host or user or both may be different.  The receiver takes
  471.             responsibility for delivering the message.
  472.  
  473.          551 User not local; please try <forward-path>
  474.  
  475.             This reply indicates that the receiver-SMTP knows the user's
  476.             mailbox is on another host and indicates the correct
  477.             forward-path to use.  Note that either the host or user or
  478.             both may be different.  The receiver refuses to accept mail
  479.             for this user, and the sender must either redirect the mail
  480.             according to the information provided or return an error
  481.             response to the originating user.
  482.  
  483.       Example 2 illustrates the use of these responses.
  484.  
  485.       -------------------------------------------------------------
  486.  
  487.                          Example of Forwarding
  488.  
  489.          Either
  490.  
  491.             S: RCPT TO:<Postel@ISI>
  492.             R: 251 User not local; will forward to <Postel@ISIF>
  493.  
  494.          Or
  495.  
  496.             S: RCPT TO:<Paul@ISIB>
  497.             R: 551 User not local; please try <Mockapetris@ISIF>
  498.  
  499.                                Example 2
  500.  
  501.       -------------------------------------------------------------
  502.  
  503.  
  504.  
  505.  
  506. Postel                                                          [Page 7]
  507.  
  508.  
  509.                                                                         
  510. November 1981                                                    RFC 788
  511. Simple Mail Transfer Protocol                                           
  512.  
  513.  
  514.  
  515.    3.3.  VERIFYING AND EXPANDING
  516.  
  517.       SMTP provides as additional features, commands to verify a user
  518.       name or expand a mailing list.  This is done with the VRFY and
  519.       EXPN commands, which have a character string arguments.  For the
  520.       VRFY command, the string is a user name, and the the response may
  521.       include the full name of the user and must include the mailbox of
  522.       the user.  For the EXPN command, the string identifies a mailing
  523.       list, and the multiline response may include the full name of the
  524.       users and must give the mailboxes on the mailing list.
  525.  
  526.       The case of verifying a user name is straightforward as shown in
  527.       example 3.
  528.  
  529.       -------------------------------------------------------------
  530.  
  531.                     Example of Verifying a User Name
  532.  
  533.          Either
  534.  
  535.             S: VRFY Postel
  536.             R: 250 Jon Postel <Postel@ISIF>
  537.  
  538.          Or
  539.  
  540.             S: VRFY Jones
  541.             R: 550 String does not match anything.
  542.  
  543.                                Example 3
  544.  
  545.       -------------------------------------------------------------
  546.  
  547.  
  548.  
  549.  
  550.  
  551.  
  552.  
  553.  
  554.  
  555.  
  556.  
  557.  
  558.  
  559.  
  560.  
  561.  
  562.  
  563.  
  564. [Page 8]                                                          Postel
  565.  
  566.  
  567.                                                                         
  568. RFC 788                                                    November 1981
  569.                                            Simple Mail Transfer Protocol
  570.  
  571.  
  572.  
  573.       The case of expanding a mailbox list requires a multiline reply as
  574.       shown in example 4.
  575.  
  576.       -------------------------------------------------------------
  577.  
  578.                   Example of Expanding a Mailing List
  579.  
  580.          Either
  581.  
  582.             S: EXPN Example-People
  583.             R: 250-Jon Postel <Postel@ISIF>
  584.             R: 250-Fred Fonebone <Fonebone@ISIQ>
  585.             R: 250-Sam Q. Smith <SQSmith@ISIQ>
  586.             R: 250-Quincy Smith <@ISIF,Q-Smith@ISI-VAXA>
  587.             R: 250-<joe@foo-unix>
  588.             R: 250 <xyz@bar-unix>
  589.  
  590.          Or
  591.  
  592.             S: EXPN Executive-Washroom-List
  593.             R: 550 Access Denied to You.
  594.  
  595.                                Example 4
  596.  
  597.       -------------------------------------------------------------
  598.  
  599.       The character string arguments of the VRFY and EXPN commands
  600.       cannot be further restricted due to the variety of implementations
  601.       of the user name and mailbox list concepts.  On some systems it
  602.       may be appropriate for the argument of the EXPN command to be a
  603.       file name for a file containing a mailing list, but again there is
  604.       a variety of file naming conventions in the internet.
  605.  
  606.       The VRFY and EXPN commands are not included in the minimum
  607.       implementation (Section 4.5.1), and are not required to work
  608.       across relays when they are implemented.
  609.  
  610.  
  611.  
  612.  
  613.  
  614.  
  615.  
  616.  
  617.  
  618.  
  619.  
  620.  
  621.  
  622. Postel                                                          [Page 9]
  623.  
  624.  
  625.                                                                         
  626. November 1981                                                    RFC 788
  627. Simple Mail Transfer Protocol                                           
  628.  
  629.  
  630.  
  631.    3.4.  SENDING AND MAILING
  632.  
  633.       The main purpose of SMTP is to deliver messages to user's
  634.       mailboxes.  A very similar service provided by some hosts is to
  635.       deliver messages to user's terminals (provided the user is active
  636.       on the host).  The delivery to the user's mailbox is called
  637.       "mailing", the delivery to the user's terminal is called
  638.       "sending".  Because in many hosts the implementation of sending is
  639.       nearly identical to the implementation of mailing these two
  640.       functions are combined in SMTP.  However the sending commands are
  641.       not included in the required minimum implementation
  642.       (Section 4.5.1).  User's should have the ability to control the
  643.       writing of messages on their terminals.  Most hosts permit the
  644.       user's to accept or refuse such messages.
  645.  
  646.       The following three command are defined to support the sending
  647.       options, these are used in the mail transaction instead of the
  648.       MAIL command and inform the receiver-SMTP of the special semantics
  649.       of this transaction:
  650.  
  651.          SEND <SP> FROM:<reverse-path> <CRLF>
  652.  
  653.             The SEND command requires that the mail data be delivered to
  654.             the user's terminal.  If the user is not active (or not
  655.             accepting terminal messages) on the host a 450 reply may
  656.             returned to a RCPT command.  The mail transaction is
  657.             successful if the message is delivered the terminal.
  658.  
  659.          SOML <SP> FROM:<reverse-path> <CRLF>
  660.  
  661.             The Send Or MaiL command requires that the mail data be
  662.             delivered to the user's terminal if the user is active (and
  663.             accepting terminal messages) on the host.  If the user is
  664.             not active (or not accepting terminal messages) then the
  665.             mail data is entered into the user's mailbox.  The mail
  666.             transaction is successful if the message is delivered either
  667.             to the terminal or the mailbox.
  668.  
  669.          SAML <SP> FROM:<reverse-path> <CRLF>
  670.  
  671.             The Send And MaiL command requires that the mail data be
  672.             delivered to the user's terminal if the user is active (and
  673.             accepting terminal messages) on the host.  In any case the
  674.             mail data is entered into the user's mailbox.  The mail
  675.             transaction is successful if the message is delivered the
  676.             mailbox.
  677.  
  678.  
  679.  
  680. [Page 10]                                                         Postel
  681.  
  682.  
  683.                                                                         
  684. RFC 788                                                    November 1981
  685.                                            Simple Mail Transfer Protocol
  686.  
  687.  
  688.  
  689.       The same reply codes that are used for the MAIL commands are used
  690.       for these commands.
  691.  
  692.  
  693.  
  694.  
  695.  
  696.  
  697.  
  698.  
  699.  
  700.  
  701.  
  702.  
  703.  
  704.  
  705.  
  706.  
  707.  
  708.  
  709.  
  710.  
  711.  
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.  
  721.  
  722.  
  723.  
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730.  
  731.  
  732.  
  733.  
  734.  
  735.  
  736.  
  737.  
  738. Postel                                                         [Page 11]
  739.  
  740.  
  741.                                                                         
  742. November 1981                                                    RFC 788
  743. Simple Mail Transfer Protocol                                           
  744.  
  745.  
  746.  
  747.    3.5.  OPENING AND CLOSING
  748.  
  749.       At the time the transmission channel is opened there is an
  750.       exchange to ensure that the hosts are communicating with the hosts
  751.       they think they are.
  752.  
  753.       The following two commands are used in transmission channel
  754.       opening and closing:
  755.  
  756.          HELO <SP> <host> <CRLF>
  757.  
  758.          QUIT <CRLF>
  759.  
  760.       In the HELO command the host sending the command identifies
  761.       itself; the command may be interpreted as saying "Hello, i am
  762.       <host>".
  763.  
  764.       -------------------------------------------------------------
  765.  
  766.                      Example of Connection Opening
  767.  
  768.          R: 220 BBN-UNIX Simple Mail Transfer Service Ready
  769.          S: HELO USC-ISIF
  770.          R: 250 BBN-UNIX
  771.  
  772.                                Example 5
  773.  
  774.       -------------------------------------------------------------
  775.  
  776.       -------------------------------------------------------------
  777.  
  778.                      Example of Connection Closing
  779.  
  780.          S: QUIT
  781.          R: 221 BBN-UNIX Service closing transmission channel
  782.  
  783.                                Example 6
  784.  
  785.       -------------------------------------------------------------
  786.  
  787.  
  788.  
  789.  
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796. [Page 12]                                                         Postel
  797.  
  798.  
  799.                                                                         
  800. RFC 788                                                    November 1981
  801.                                            Simple Mail Transfer Protocol
  802.  
  803.  
  804.  
  805.    3.6.  RELAYING
  806.  
  807.       The forward-path may be a source route of the form
  808.       "@ONE,@TWO,JOE@THREE", where ONE, TWO, and THREE are hosts.  This
  809.       form is used to emphasize the distinction between an address and a
  810.       route.  The mailbox is an absolute address, and the route is
  811.       information about how to get there.  The two concepts should not
  812.       be confused.
  813.  
  814.       The elements of the forward-path are moved to the reverse-path as
  815.       the message is relayed from one server-SMTP to another.  The
  816.       reverse-path is a reverse source route, (i.e., a source route from
  817.       the current location of the message to the originator of the
  818.       message).  When a server-SMTP deletes its identifier from the
  819.       forward-path and inserts it into the reverse-path, it must use the
  820.       name it is known by in the environment it is sending into, not the
  821.       environment the mail came from, in case the server-SMTP is known
  822.       by different names in different environments.
  823.  
  824.       Using source routing the receiver-SMTP receives mail to be relayed
  825.       to another server-SMTP  The receiver-SMTP may accept or reject the
  826.       task of relaying the mail in the same way it accepts or rejects
  827.       mail for a local user.  The receiver-SMTP transforms the command
  828.       arguments by moving its own identifier from the forward-path to
  829.       the beginning of the reverse-path.  The receiver-SMTP then becomes
  830.       a sender-SMTP, establishes a transmission channel to the next SMTP
  831.       in the forward-path, and sends it the mail.
  832.  
  833.       The first host in the reverse-path should be the host sending the
  834.       SMTP commands, and the first host in the forward-path should be
  835.       the host receiving the SMTP commands.
  836.  
  837.       Notice that the forward-path and reverse-path appear in the SMTP
  838.       commands and replies, but not necessarily in the message.  That
  839.       is, there is no need for these paths and especially this syntax to
  840.       appear in the "To:" , "From:", "CC:", etc. fields of the message
  841.       header.
  842.  
  843.       If a server-SMTP has accepted the task of relaying the mail and
  844.       later finds that the forward-path is incorrect or that the mail
  845.       cannot be delivered for whatever reason, then it must construct an
  846.       "undeliverable mail" notification message and send it to the
  847.       originator of the undeliverable mail (as indicated by the
  848.       reverse-path).
  849.  
  850.  
  851.  
  852.  
  853.  
  854. Postel                                                         [Page 13]
  855.  
  856.  
  857.                                                                         
  858. November 1981                                                    RFC 788
  859. Simple Mail Transfer Protocol                                           
  860.  
  861.  
  862.  
  863.       This notification message must be from the server-SMTP at this
  864.       host.  Of course, server-SMTPs should not send notification
  865.       messages about problems with notification messages.  One way to
  866.       prevent loops in error reporting is to specify a null reverse-path
  867.       in the MAIL command of a notification message.  When such a
  868.       message is relayed it is permissible to leave the reverse-path
  869.       null.  A MAIL command with a null reverse-path appears as follows:
  870.  
  871.          MAIL FROM:<>
  872.  
  873.       An undeliverable mail notification message is shown in example 7.
  874.       This notification is in response to a message originated by JOE at
  875.       HOSTW and sent via HOSTX to HOSTY with instructions to relay it on
  876.       to HOSTZ.  What we see in the example is the transaction between
  877.       HOSTY and HOSTX, which is the first step in the return of the
  878.       notification message.
  879.  
  880.       -------------------------------------------------------------
  881.  
  882.             Example Undeliverable Mail Notification Message
  883.  
  884.          S: MAIL FROM:<>
  885.          R: 250 ok
  886.          S: RCPT TO:<@HOSTX,JOE@HOSTW>
  887.          R: 250 ok
  888.          S: DATA
  889.          R: 354 send the mail data, end with .
  890.          S: Date: 23 Oct 81
  891.          S: Sender: SMTP@HOSTY
  892.          S: Subject: Mail System Problem
  893.          S:
  894.          S:   Sorry JOE, your message to SAM@HOSTZ lost.
  895.          S:   HOSTZ said this:
  896.          S:    "550 No Such User"
  897.          S: .
  898.          R: 250 ok
  899.  
  900.                                Example 7
  901.  
  902.       -------------------------------------------------------------
  903.  
  904.  
  905.  
  906.  
  907.  
  908.  
  909.  
  910.  
  911.  
  912. [Page 14]                                                         Postel
  913.  
  914.  
  915.                                                                         
  916. RFC 788                                                    November 1981
  917.                                            Simple Mail Transfer Protocol
  918.  
  919.  
  920.  
  921.    3.7.  DOMAINS
  922.  
  923.       At some not too distant future time it might be necessary to
  924.       expand the mailbox format to include a region or name domain
  925.       identifier.  There is quite a bit of discussion on this at
  926.       present, and is likely that SMTP will be revised in the future to
  927.       take into account naming domains.
  928.  
  929.       The examples in this document do not show mail domains.
  930.  
  931.  
  932.  
  933.  
  934.  
  935.  
  936.  
  937.  
  938.  
  939.  
  940.  
  941.  
  942.  
  943.  
  944.  
  945.  
  946.  
  947.  
  948.  
  949.  
  950.  
  951.  
  952.  
  953.  
  954.  
  955.  
  956.  
  957.  
  958.  
  959.  
  960.  
  961.  
  962.  
  963.  
  964.  
  965.  
  966.  
  967.  
  968.  
  969.  
  970. Postel                                                         [Page 15]
  971.  
  972.  
  973.                                                                         
  974. November 1981                                                    RFC 788
  975. Simple Mail Transfer Protocol                                           
  976.  
  977.  
  978.  
  979. 4.  THE SMTP SPECIFICATIONS
  980.  
  981.    4.1.  SMTP COMMANDS
  982.  
  983.       4.1.1.  COMMAND SEMANTICS
  984.  
  985.          The SMTP commands define the mail transfer or the mail system
  986.          function requested by the user.  SMTP commands are character
  987.          strings terminated by <CRLF>.  The command codes themselves are
  988.          alphabetic characters terminated by <SP> if parameters follow
  989.          and <CRLF> otherwise.  The syntax of mailboxes must conform to
  990.          receiver site conventions.  The SMTP commands are discussed
  991.          below.  The SMTP replies are discussed in the Section 4.2.
  992.  
  993.          A mail transaction involves several data objects which are
  994.          communicated as arguments to different commands.  The
  995.          reverse-path is the argument of the MAIL command, the
  996.          forward-path is the argument of the RCPT command, and the mail
  997.          data is the argument of the DATA command.  These arguments or
  998.          data objects must be transmitted and held pending the
  999.          confirmation communicated by the end of mail data indication
  1000.          which finalizes the transaction.  The model for this is that
  1001.          distinct buffers are provided to hold the types of data
  1002.          objects, that is, there is a reverse-path buffer, a
  1003.          forward-path buffer, and a mail data buffer.  Specific commands
  1004.          cause information to be appended to a specific buffer, or cause
  1005.          one or more buffers to be cleared.
  1006.  
  1007.          HELLO (HELO)
  1008.  
  1009.             This command is used to identify the sender-SMTP to the
  1010.             receiver-SMTP.  The argument field contains the host name of
  1011.             the sender-SMTP.
  1012.  
  1013.             The receiver-SMTP identifies itself to the sender-SMTP in
  1014.             the connection greeting reply, and in the response to this
  1015.             command.
  1016.  
  1017.          MAIL (MAIL)
  1018.  
  1019.             This command is used to initiate a mail transaction in which
  1020.             the mail data is delivered to one or more mailboxes.  The
  1021.             argument field contains a reverse-path.
  1022.  
  1023.             The reverse-path consists of an optional list of hosts and
  1024.             the sender mailbox.  When the list of hosts is present, it
  1025.  
  1026.  
  1027.  
  1028. [Page 16]                                                         Postel
  1029.  
  1030.  
  1031.                                                                         
  1032. RFC 788                                                    November 1981
  1033.                                            Simple Mail Transfer Protocol
  1034.  
  1035.  
  1036.  
  1037.             is a "reverse" source route and indicates that the mail was
  1038.             relayed through each host on the list (the first host in the
  1039.             list was the most recent relay).  This list is used as a
  1040.             source route to return non-delivery notices to the sender.
  1041.             As each relay host adds itself to the beginning of the list,
  1042.             it must use its name as known in the IPCE to which it is
  1043.             relaying the mail rather than the IPCE from which the mail
  1044.             came (if they are different).  In some types of error
  1045.             reporting messages (for example, undeliverable mail
  1046.             notifications) the reverse-path may be null (see Example 7).
  1047.  
  1048.             This command clears the reverse-path buffer, the
  1049.             forward-path buffer, and the mail data buffer; and inserts
  1050.             the reverse-path information from this command into the
  1051.             reverse-path buffer.
  1052.  
  1053.          RECIPIENT (RCPT)
  1054.  
  1055.             This command is used to identify an individual recipient of
  1056.             the mail data; multiple recipients are specified by multiple
  1057.             use of this command.
  1058.  
  1059.             The forward-path consists of an optional list of hosts and a
  1060.             required destination mailbox.  When the list of hosts is
  1061.             present, it is a source route and indicates that the mail
  1062.             must be relayed to the next host on the list.  If the
  1063.             receiver-SMTP is does not implement the relay function it
  1064.             may user the same reply it would for an unknown local user
  1065.             (550).
  1066.  
  1067.             When mail is relayed, the relay host must remove itself from
  1068.             the beginning forward-path and put itself at the beginning
  1069.             of the reverse-path.  When mail reaches its ultimate
  1070.             destination (the forward-path contains only a destination
  1071.             mailbox), the receiver-SMTP inserts it into the destination
  1072.             mailbox in accordance with its host mail conventions.
  1073.  
  1074.                For example, mail received at relay host A with arguments
  1075.  
  1076.                   FROM:<X@Y>
  1077.                   TO:<@A,@B,C@D>
  1078.  
  1079.                will be relayed on to host B with arguments
  1080.  
  1081.                   FROM:<@A,X@Y>
  1082.                   TO:<@B,C@D>.
  1083.  
  1084.  
  1085.  
  1086. Postel                                                         [Page 17]
  1087.  
  1088.  
  1089.                                                                         
  1090. November 1981                                                    RFC 788
  1091. Simple Mail Transfer Protocol                                           
  1092.  
  1093.  
  1094.  
  1095.             This command causes its forward-path argument to be appended
  1096.             to the forward-path buffer.
  1097.  
  1098.          DATA (DATA)
  1099.  
  1100.             The receiver treats the lines following the command as mail
  1101.             data from the sender.  This command causes the mail data
  1102.             from this command to be appended to the mail data buffer.
  1103.             The mail data may contain any of the 128 ASCII character
  1104.             codes.
  1105.  
  1106.             The mail data is terminated by a line containing only a
  1107.             period, that is the character sequence "<CRLF>.<CRLF>" (see
  1108.             Section 4.5.2 on Transparency).  This is the end of mail
  1109.             data indication.
  1110.  
  1111.             The end of mail data indication requires that the receiver
  1112.             must now process the stored mail transaction information.
  1113.             This processing consumes the information in the reverse-path
  1114.             buffer, the forward-path buffer, and the mail data buffer,
  1115.             and on the completion of this command these buffers are
  1116.             cleared.  If the processing is successful the receiver must
  1117.             send an OK reply.  If the processing fails completely the
  1118.             receiver must send a failure reply.
  1119.  
  1120.             When the receiver-SMTP accepts a message either for relaying
  1121.             or for final delivery it inserts at the beginning of the
  1122.             mail data a time stamp line.  The time stamp line indicates
  1123.             the identity of the host that sent the message, and the
  1124.             identity of the host that received the message (and is
  1125.             inserting this time stamp), and the date and time the
  1126.             message was received.  Relayed messages will have multiple
  1127.             time stamp lines.
  1128.  
  1129.             When the receiver-SMTP makes the "final delivery" of a
  1130.             message it inserts at the beginning of the mail data a
  1131.             return path line.  The return path line preserves the
  1132.             information in the <reverse-path> from the MAIL command.
  1133.             Here, final delivery means the message leaves the SMTP
  1134.             world.  Normally, this would mean it has been delivered to
  1135.             the destination user, but in some cases it may be further
  1136.             processed and transmitted by another mail system.
  1137.  
  1138.             The preceding two paragraphs imply that the final mail data
  1139.  
  1140.  
  1141.  
  1142.  
  1143.  
  1144. [Page 18]                                                         Postel
  1145.  
  1146.  
  1147.                                                                         
  1148. RFC 788                                                    November 1981
  1149.                                            Simple Mail Transfer Protocol
  1150.  
  1151.  
  1152.  
  1153.             will begin with a  return path line, followed by one or more
  1154.             time stamp lines.  These lines will be followed by the mail
  1155.             data header and body [2].  For example:
  1156.  
  1157.                Return-Path: <@GHI,@DEF,@ABC,JOE@ABC>
  1158.                Mail-From: GHI received by JKL at 27-Oct-81 15:27:39-PST
  1159.                Mail-From: DEF received by GHI at 27-Oct-81 15:15:13-PST
  1160.                Mail-From: ABC received by DEF at 27-Oct-81 15:01:59-PST
  1161.                Date: 27-Oct-81 15:01:01-PST
  1162.                From: JOE@ABC
  1163.                Subject: Improved Mailing System Installed
  1164.                To: SAM@JKL
  1165.                
  1166.                This is to inform you that ...
  1167.  
  1168.             Special mention is needed of the response and further action
  1169.             required when the processing following the end of mail data
  1170.             indication is partially successful.  This could arise if
  1171.             after accepting several recipients and the mail data, the
  1172.             receiver-SMTP finds that the mail data can be successfully
  1173.             delivered to some of the recipients, but it cannot be to
  1174.             others (for example, due to mailbox space allocation
  1175.             problems).  In such a situation, the response to the DATA
  1176.             command must be an OK reply.  But, the receiver-SMTP must
  1177.             compose and send an "undeliverable mail" notification
  1178.             message to the originator of the message.  Either a single
  1179.             notification which lists all of the recipients that failed
  1180.             to get the message, or separate notification messages must
  1181.             be sent for each failed recipient (see Example 7).  All
  1182.             undeliverable mail notification messages are sent using the
  1183.             MAIL command (even if they result from processing a SEND,
  1184.             SOML, or SAML command).
  1185.  
  1186.          SEND (SEND)
  1187.  
  1188.             This command is used to initiate a mail transaction in which
  1189.             the mail data is delivered to one or more terminals.  The
  1190.             argument field contains a reverse-path.  This command is
  1191.             successful if the message is delivered to the terminal.
  1192.  
  1193.             The reverse-path consists of an optional list of hosts and
  1194.             the sender mailbox.  When the list of hosts is present, it
  1195.             is a "reverse" source route and indicates that the mail was
  1196.             relayed through each host on the list (the first host in the
  1197.             list was the most recent relay).  This list is used as a
  1198.             source route to return non-delivery notices to the sender.
  1199.  
  1200.  
  1201.  
  1202. Postel                                                         [Page 19]
  1203.  
  1204.  
  1205.                                                                         
  1206. November 1981                                                    RFC 788
  1207. Simple Mail Transfer Protocol                                           
  1208.  
  1209.  
  1210.  
  1211.             As each relay host adds itself to the beginning of the list,
  1212.             it must use its name as known in the IPCE to which it is
  1213.             relaying the mail rather than the IPCE from which the mail
  1214.             came (if they are different).
  1215.  
  1216.             This command clears the reverse-path buffer, the
  1217.             forward-path buffer, and the mail data buffer; and inserts
  1218.             the reverse-path information from this command into the
  1219.             reverse-path buffer.
  1220.  
  1221.          SEND OR MAIL (SOML)
  1222.  
  1223.             This command is used to initiate a mail transaction in which
  1224.             the mail data is delivered to one or more terminals or
  1225.             mailboxes. For each recipient the mail data is delivered to
  1226.             the recipient's terminal if the recipient is active on the
  1227.             host (and accepting terminal messages), otherwise to the
  1228.             recipient's mailbox.  The argument field contains a
  1229.             reverse-path.  This command is successful if the message is
  1230.             delivered to the terminal or the mailbox.
  1231.  
  1232.             The reverse-path consists of an optional list of hosts and
  1233.             the sender mailbox.  When the list of hosts is present, it
  1234.             is a "reverse" source route and indicates that the mail was
  1235.             relayed through each host on the list (the first host in the
  1236.             list was the most recent relay).  This list is used as a
  1237.             source route to return non-delivery notices to the sender.
  1238.             As each relay host adds itself to the beginning of the list,
  1239.             it must use its name as known in the IPCE to which it is
  1240.             relaying the mail rather than the IPCE from which the mail
  1241.             came (if they are different).
  1242.  
  1243.             This command clears the reverse-path buffer, the
  1244.             forward-path buffer, and the mail data buffer; and inserts
  1245.             the reverse-path information from this command into the
  1246.             reverse-path buffer.
  1247.  
  1248.          SEND AND MAIL (SAML)
  1249.  
  1250.             This command is used to initiate a mail transaction in which
  1251.             the mail data is delivered to one or more terminals and
  1252.             mailboxes. For each recipient the mail data is delivered to
  1253.             the recipient's terminal if the recipient is active on the
  1254.             host (and accepting terminal messages), and for all
  1255.  
  1256.  
  1257.  
  1258.  
  1259.  
  1260. [Page 20]                                                         Postel
  1261.  
  1262.  
  1263.                                                                         
  1264. RFC 788                                                    November 1981
  1265.                                            Simple Mail Transfer Protocol
  1266.  
  1267.  
  1268.  
  1269.             recipients to the recipient's mailbox.  The argument field
  1270.             contains a reverse-path.  This command is successful if the
  1271.             message is delivered to the mailbox.
  1272.  
  1273.             The reverse-path consists of an optional list of hosts and
  1274.             the sender mailbox.  When the list of hosts is present, it
  1275.             is a "reverse" source route and indicates that the mail was
  1276.             relayed through each host on the list (the first host in the
  1277.             list was the most recent relay).  This list is used as a
  1278.             source route to return non-delivery notices to the sender.
  1279.             As each relay host adds itself to the beginning of the list,
  1280.             it must use its name as known in the IPCE to which it is
  1281.             relaying the mail rather than the IPCE from which the mail
  1282.             came (if they are different).
  1283.  
  1284.             This command clears the reverse-path buffer, the
  1285.             forward-path buffer, and the mail data buffer; and inserts
  1286.             the reverse-path information from this command into the
  1287.             reverse-path buffer.
  1288.  
  1289.          RESET (RSET)
  1290.  
  1291.             This command specifies that the current mail transaction is
  1292.             to be aborted.  Any stored sender, recipients, and mail data
  1293.             must be discarded, and all buffers and state tables cleared.
  1294.             The receiver must send an OK reply.
  1295.  
  1296.          VERIFY (VRFY)
  1297.  
  1298.             This command asks the receiver to confirm that the argument
  1299.             identifies a user.  If it is a user name, the full name of
  1300.             the user (if known) and the fully specified mailbox are
  1301.             returned.
  1302.  
  1303.             This command has no effect on any of the reverse-path
  1304.             buffer, the forward-path buffer, or the mail data buffer.
  1305.  
  1306.          EXPAND (EXPN)
  1307.  
  1308.             This command asks the receiver to confirm that the argument
  1309.             identifies a mailing list, and if so, to return the
  1310.             membership of that list.  The full name of the users (if
  1311.             known) and the fully specified mailboxes are returned in a
  1312.             multiline reply.
  1313.  
  1314.  
  1315.  
  1316.  
  1317.  
  1318. Postel                                                         [Page 21]
  1319.  
  1320.  
  1321.                                                                         
  1322. November 1981                                                    RFC 788
  1323. Simple Mail Transfer Protocol                                           
  1324.  
  1325.  
  1326.  
  1327.             This command has no effect on any of the reverse-path
  1328.             buffer, the forward-path buffer, or the mail data buffer.
  1329.  
  1330.          HELP (HELP)
  1331.  
  1332.             This command causes the receiver to send helpful information
  1333.             to the sender of the HELP command.  The command may take an
  1334.             argument (e.g., any command name) and return more specific
  1335.             information as a response.
  1336.  
  1337.             This command has no effect on any of the reverse-path
  1338.             buffer, the forward-path buffer, or the mail data buffer.
  1339.  
  1340.          NOOP (NOOP)
  1341.  
  1342.             This command does not affect any parameters or previously
  1343.             entered commands.  It specifies no action other than that
  1344.             the receiver send an OK reply.
  1345.  
  1346.             This command has no effect on any of the reverse-path
  1347.             buffer, the forward-path buffer, or the mail data buffer.
  1348.  
  1349.          QUIT (QUIT)
  1350.  
  1351.             This command specifies that the receiver must send an OK
  1352.             reply, and then close the transmission channel.
  1353.  
  1354.             The receiver should not close the transmission channel until
  1355.             it receives and replies to a QUIT command (even if there was
  1356.             an error).  The sender should not close the transmission
  1357.             channel until it send a QUIT command and receives the reply
  1358.             (even if there was an error response to a previous command).
  1359.             If the connection is closed prematurely the receiver should
  1360.             act as if a RSET command had been received (canceling any
  1361.             pending transaction, but not undoing any previously
  1362.             completed transaction), the sender should act as if the
  1363.             command or transaction in progress had received a temporary
  1364.             error (4xx).
  1365.  
  1366.          There are restrictions on the order in which these command may
  1367.          be used.
  1368.  
  1369.             The first command in a session must be the HELO command.
  1370.             The HELO command may be used later in a session as well.
  1371.  
  1372.  
  1373.  
  1374.  
  1375.  
  1376. [Page 22]                                                         Postel
  1377.  
  1378.  
  1379.                                                                         
  1380. RFC 788                                                    November 1981
  1381.                                            Simple Mail Transfer Protocol
  1382.  
  1383.  
  1384.  
  1385.             The NOOP, HELP, EXPN, and VRFY commands can be used at any
  1386.             time during a session.
  1387.  
  1388.             The MAIL, SEND, SOML, or SAML commands begin a mail
  1389.             transaction.  Once started a mail transaction consists of
  1390.             one of the transaction beginning commands, one or more RCPT
  1391.             commands, and a DATA command, in that order.  A mail
  1392.             transaction may be aborted by the RSET command.  There may
  1393.             be zero or more transactions in a session.
  1394.  
  1395.             The last command in a session must be the QUIT command.  The
  1396.             QUIT command can not be used at any other time in a session.
  1397.  
  1398.       4.1.2.  COMMAND SYNTAX
  1399.  
  1400.          The commands consist of a command code followed by an argument
  1401.          field.  Command codes are four alphabetic characters.  Upper
  1402.          and lower case alphabetic characters are to be treated
  1403.          identically.  Thus, any of the following may represent the mail
  1404.          command:
  1405.  
  1406.             MAIL    Mail    mail    MaIl    mAIl
  1407.  
  1408.          This also applies to any symbols representing parameter values,
  1409.          such as "TO" or "to" for the forward-path.  Command codes and
  1410.          the argument fields are separated by one or more spaces.
  1411.          However, within the reverse-path and forward-path arguments
  1412.          case is important.  In particular, in some hosts the user
  1413.          "smith" is different from the user "Smith".
  1414.  
  1415.          The argument field consists of a variable length character
  1416.          string ending with the character sequence <CRLF>.  The receiver
  1417.          is to take no action until this sequence is received.
  1418.  
  1419.          Square brackets denote an optional argument field.  If the
  1420.          option is not taken, the appropriate default is implied.
  1421.  
  1422.  
  1423.  
  1424.  
  1425.  
  1426.  
  1427.  
  1428.  
  1429.  
  1430.  
  1431.  
  1432.  
  1433.  
  1434. Postel                                                         [Page 23]
  1435.  
  1436.  
  1437.                                                                         
  1438. November 1981                                                    RFC 788
  1439. Simple Mail Transfer Protocol                                           
  1440.  
  1441.  
  1442.  
  1443.          The following are the SMTP commands:
  1444.  
  1445.             HELO <SP> <host> <CRLF>
  1446.  
  1447.             MAIL <SP> FROM:<reverse-path> <CRLF>
  1448.  
  1449.             RCPT <SP> TO:<forward-path> <CRLF>
  1450.  
  1451.             DATA <CRLF>
  1452.  
  1453.             RSET <CRLF>
  1454.  
  1455.             SEND <SP> FROM:<reverse-path> <CRLF>
  1456.  
  1457.             SOML <SP> FROM:<reverse-path> <CRLF>
  1458.  
  1459.             SAML <SP> FROM:<reverse-path> <CRLF>
  1460.  
  1461.             VRFY <SP> <string> <CRLF>
  1462.  
  1463.             EXPN <SP> <string> <CRLF>
  1464.  
  1465.             HELP [<SP> <string>] <CRLF>
  1466.  
  1467.             NOOP <CRLF>
  1468.  
  1469.             QUIT <CRLF>
  1470.  
  1471.  
  1472.  
  1473.  
  1474.  
  1475.  
  1476.  
  1477.  
  1478.  
  1479.  
  1480.  
  1481.  
  1482.  
  1483.  
  1484.  
  1485.  
  1486.  
  1487.  
  1488.  
  1489.  
  1490.  
  1491.  
  1492. [Page 24]                                                         Postel
  1493.  
  1494.  
  1495.                                                                         
  1496. RFC 788                                                    November 1981
  1497.                                            Simple Mail Transfer Protocol
  1498.  
  1499.  
  1500.  
  1501.          The syntax of the above argument fields (using BNF notation
  1502.          where applicable) is given below.  The "..." notation indicates
  1503.          that a field may be repeated one or more times.
  1504.  
  1505.             <reverse-path> ::= <path>
  1506.  
  1507.             <forward-path> ::= <path>
  1508.  
  1509.             <path> ::= "<" ["@" <host> "," ...] <mailbox> ">"
  1510.  
  1511.             <host> ::= <a> <string> | "#" <number> | "[" <dotnum> "]"
  1512.  
  1513.             <mailbox> ::= <user> "@" <host>
  1514.  
  1515.             <user> ::= <string>
  1516.  
  1517.             <string> ::= <char> | <char> <string>
  1518.  
  1519.             <char> ::= <c> | '\' <c> | '\' <s>
  1520.  
  1521.             <dotnum> ::= <snum> "." <snum> "." <snum> "." <snum>
  1522.  
  1523.             <number> ::= <d> | <d> <number>
  1524.  
  1525.             <snum> ::= three digits representing a decimal integer value
  1526.                       in the range 0 through 255
  1527.  
  1528.             <a> ::= any one of the 52 alphabetic characters A through Z
  1529.                       in upper case and a through z in lower case
  1530.  
  1531.             <c> ::= any one of the 128 ASCII characters except
  1532.                       <specials>
  1533.  
  1534.             <d> ::= any one of the ten digits 0 through 9
  1535.  
  1536.             <s> ::= any one of <specials>
  1537.  
  1538.             <specials> ::= '<', '>', '(', ')', '\', ',', ';', ':', '@',
  1539.             '"', and the control characters (ASCII codes 0 through 37
  1540.             octal inclusive and 177 octal)
  1541.  
  1542.          Note that the backslash, '\', is a quote character, which is
  1543.          used to indicate that the next character is to be used
  1544.          literally (instead of its normal interpretation).  For example,
  1545.          "Joe\,Smith" could be used to indicate a single nine character
  1546.          user field with comma being the fourth character of the field.
  1547.  
  1548.  
  1549.  
  1550. Postel                                                         [Page 25]
  1551.  
  1552.  
  1553.                                                                         
  1554. November 1981                                                    RFC 788
  1555. Simple Mail Transfer Protocol                                           
  1556.  
  1557.  
  1558.  
  1559.          Hosts are generally known by names which are translated to
  1560.          addresses in each host.  Sometimes a host is not known to the
  1561.          translation function and communication is blocked.  To bypass
  1562.          this barrier two numeric forms are also allowed for host
  1563.          "names".  One form is a decimal integer prefixed by a pound
  1564.          sign, "#", which indicates the number is the address of the
  1565.          host.  Another form is four small decimal integers separated by
  1566.          dots and enclosed by brackets, e.g., "[123.255.37.2]", which
  1567.          indicates a 32-bit ARPA Internet Address in four 8-bit fields.
  1568.  
  1569.          The time stamp line and the return path line are formally
  1570.          defined as follows:
  1571.  
  1572.          <return-path-line> ::= "Return-Path:" <SP><reverse-path><CRLF>
  1573.  
  1574.          <time-stamp-line> ::= "Mail-From:" <SP> <stamp> <CRLF>
  1575.  
  1576.             <stamp> ::= [<ptcl>] <from-host> <this-host> <daytime>
  1577.  
  1578.             <ptcl> ::= <protocol> <SP> "host" <SP>
  1579.  
  1580.             <from-host> ::= <host> <SP>
  1581.  
  1582.             <this-host> ::= "received by" <SP> <host> <SP>
  1583.  
  1584.             <protocol> ::= "TCP" | "NCP" | "NITS" | "X25" | "INTERNET" |
  1585.                       "ARPANET"
  1586.  
  1587.                Note: INTERNET = TCP, ARPANET = NCP, and if the <ptcl> is
  1588.                          not present INTERNET is assumed.
  1589.  
  1590.             <daytime> ::= "at" <SP> <date> <SP> <time>
  1591.  
  1592.             <date> ::= <dd> "-" <mon> "-" <yy>
  1593.  
  1594.             <time> ::= <hh> ":" <mm> ":" <ss> "-" <zone>
  1595.  
  1596.             <dd> ::= the one or two decimal integer day of the month in
  1597.                       the range 1 to 31.
  1598.  
  1599.             <mon> ::= "JAN" | "FEB" | "MAR" | "APR" | "MAY" | "JUN" |
  1600.                       "JUL" | "AUG" | "SEP" | "OCT" | "NOV" | "DEC"
  1601.  
  1602.             <yy> ::= the two decimal integer year of the century in the
  1603.                       range 01 to 99.
  1604.  
  1605.  
  1606.  
  1607.  
  1608. [Page 26]                                                         Postel
  1609.  
  1610.  
  1611.                                                                         
  1612. RFC 788                                                    November 1981
  1613.                                            Simple Mail Transfer Protocol
  1614.  
  1615.  
  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 time zone designator (as in [2]) or "UT" for
  1627.                       Universal Time (the default).
  1628.  
  1629.          Return Path Example:
  1630.  
  1631.             Return-Path: <@CHARLIE,@BAKER,JOE@ABLE>
  1632.  
  1633.          Mail From Example:
  1634.  
  1635.             Mail-From: ABC received by XYZ at 22-OCT-81 09:23:59-PDT
  1636.  
  1637.          
  1638.  
  1639.  
  1640.  
  1641.  
  1642.  
  1643.  
  1644.  
  1645.  
  1646.  
  1647.  
  1648.  
  1649.  
  1650.  
  1651.  
  1652.  
  1653.  
  1654.  
  1655.  
  1656.  
  1657.  
  1658.  
  1659.  
  1660.  
  1661.  
  1662.  
  1663.  
  1664.  
  1665.  
  1666. Postel                                                         [Page 27]
  1667.  
  1668.  
  1669.                                                                         
  1670. November 1981                                                    RFC 788
  1671. Simple Mail Transfer Protocol                                           
  1672.  
  1673.  
  1674.  
  1675.    4.2.  SMTP REPLIES
  1676.  
  1677.       Replies to SMTP commands are devised to ensure the synchronization
  1678.       of requests and actions in the process of mail transfer, and to
  1679.       guarantee that the sender-SMTP always knows the state of the
  1680.       receiver-SMTP.  Every command must generate exactly one reply.
  1681.  
  1682.          The details of the command-reply sequence are made explicit in
  1683.          Section 5.3 on Sequencing and Section 5.4 State Diagrams.
  1684.  
  1685.       An SMTP reply consists of a three digit number (transmitted as
  1686.       three alphanumeric characters) followed by some text.  The number
  1687.       is intended for use by automata to determine what state to enter
  1688.       next; the text is meant for the human user.  It is intended that
  1689.       the three digits contain enough encoded information that the
  1690.       sender-SMTP need not examine the text and may either discard it or
  1691.       pass it on to the user, as appropriate.  In particular, the text
  1692.       may be receiver-dependent, so there are likely to be varying texts
  1693.       for each reply code.  A discussion of the theory of reply codes is
  1694.       given in the Appendix E.  Formally, a reply is defined to be the
  1695.       sequence:  a three-digit code, <SP>, one line of text, and <CRLF>,
  1696.       or a multiline reply (as defined in Appendix E).  Only the EXPN
  1697.       and HELP command are expected to result in multiline replies in
  1698.       normal circumstances, however multiline replies are allowed for
  1699.       any command.
  1700.  
  1701.  
  1702.  
  1703.  
  1704.  
  1705.  
  1706.  
  1707.  
  1708.  
  1709.  
  1710.  
  1711.  
  1712.  
  1713.  
  1714.  
  1715.  
  1716.  
  1717.  
  1718.  
  1719.  
  1720.  
  1721.  
  1722.  
  1723.  
  1724. [Page 28]                                                         Postel
  1725.  
  1726.  
  1727.                                                                         
  1728. RFC 788                                                    November 1981
  1729.                                            Simple Mail Transfer Protocol
  1730.  
  1731.  
  1732.  
  1733.       4.2.1.  REPLY CODES BY FUNCTION GROUPS
  1734.  
  1735.          500 Syntax error, command unrecognized
  1736.             [This may include errors such as command line too long]
  1737.          501 Syntax error in parameters or arguments
  1738.          502 Command not implemented
  1739.          503 Bad sequence of commands
  1740.          504 Command parameter not implemented
  1741.           
  1742.          211 System status, or system help reply
  1743.          214 Help message
  1744.             [Information on how to use the receiver or the meaning of a
  1745.             particular non-standard command; this reply is useful only
  1746.             to the human user]
  1747.           
  1748.          220 <host> Service ready
  1749.          221 <host> Service closing transmission channel
  1750.          421 <host> Service not available, closing transmission channel
  1751.             [This may be a reply to any command if the service knows it
  1752.             must shut down]
  1753.           
  1754.          250 Requested mail action okay, completed
  1755.          251 User not local; will forward to <forward-path>
  1756.          450 Requested mail action not taken: mailbox unavailable
  1757.             [E.g., mailbox busy]
  1758.          550 Requested action not taken: mailbox unavailable
  1759.             [E.g., mailbox not found, no access]
  1760.          451 Requested action aborted: error in processing
  1761.          551 User not local; please try <forward-path>
  1762.          452 Requested action not taken: insufficient system storage
  1763.          552 Requested mail action aborted: exceeded storage allocation
  1764.          553 Requested action not taken: mailbox name not allowed
  1765.             [E.g., mailbox syntax incorrect]
  1766.          354 Start mail input; end with <CRLF>.<CRLF>
  1767.          554 Transaction failed
  1768.          
  1769.  
  1770.  
  1771.  
  1772.  
  1773.  
  1774.  
  1775.  
  1776.  
  1777.  
  1778.  
  1779.  
  1780.  
  1781.  
  1782. Postel                                                         [Page 29]
  1783.  
  1784.  
  1785.                                                                         
  1786. November 1981                                                    RFC 788
  1787. Simple Mail Transfer Protocol                                           
  1788.  
  1789.  
  1790.  
  1791.       4.2.2.  NUMERIC ORDER LIST OF REPLY CODES
  1792.  
  1793.          211 System status, or system help reply
  1794.          214 Help message
  1795.             [Information on how to use the receiver or the meaning of a
  1796.             particular non-standard command; this reply is useful only
  1797.             to the human user]
  1798.          220 <host> Service ready
  1799.          221 <host> Service closing transmission channel
  1800.          250 Requested mail action okay, completed
  1801.          251 User not local; will forward to <forward-path>
  1802.           
  1803.          354 Start mail input; end with <CRLF>.<CRLF>
  1804.           
  1805.          421 <host> Service not available, closing transmission channel
  1806.             [This may be a reply to any command if the service knows it
  1807.             must shut down]
  1808.          450 Requested mail action not taken: mailbox unavailable
  1809.             [E.g., mailbox busy]
  1810.          451 Requested action aborted: local error in processing
  1811.          452 Requested action not taken: insufficient system storage
  1812.           
  1813.          500 Syntax error, command unrecognized
  1814.             [This may include errors such as command line too long]
  1815.          501 Syntax error in parameters or arguments
  1816.          502 Command not implemented
  1817.          503 Bad sequence of commands
  1818.          504 Command parameter not implemented
  1819.          550 Requested action not taken: mailbox unavailable
  1820.             [E.g., mailbox not found, no access]
  1821.          551 User not local; please try <forward-path>
  1822.          552 Requested mail action aborted: exceeded storage allocation
  1823.          553 Requested action not taken: mailbox name not allowed
  1824.             [E.g., mailbox syntax incorrect]
  1825.          554 Transaction failed
  1826.          
  1827.  
  1828.  
  1829.  
  1830.  
  1831.  
  1832.  
  1833.  
  1834.  
  1835.  
  1836.  
  1837.  
  1838.  
  1839.  
  1840. [Page 30]                                                         Postel
  1841.  
  1842.  
  1843.                                                                         
  1844. RFC 788                                                    November 1981
  1845.                                            Simple Mail Transfer Protocol
  1846.  
  1847.  
  1848.  
  1849.    4.3.  SEQUENCING OF COMMANDS AND REPLIES
  1850.  
  1851.       The communication between the sender and receiver is intended to
  1852.       be an alternating dialogue, controlled by the sender.  As such,
  1853.       the sender issues a command and the receiver responds with a
  1854.       reply.  The sender must wait for this response before sending
  1855.       further commands.
  1856.  
  1857.       One important reply is the connection greeting.  Normally, a
  1858.       receiver will send a 220 "Awaiting input" reply when the
  1859.       connection is completed.  The sender should wait for this greeting
  1860.       message before sending any commands.
  1861.  
  1862.          Note: all the greeting type replies have the official name of
  1863.          the server host as the first word following the reply code.
  1864.  
  1865.             For example,
  1866.  
  1867.                220 <SP> USC-ISIF <SP> Service ready <CRLF>
  1868.  
  1869.       The table below lists alternative success and failure replies for
  1870.       each command.  These must be strictly adhered to; a receiver may
  1871.       substitute text in the replies, but the meaning and action implied
  1872.       by the code numbers and by the specific command reply sequence
  1873.       cannot be altered.
  1874.  
  1875.       COMMAND-REPLY SEQUENCES
  1876.  
  1877.          Each command is listed with its possible replies.  The prefixes
  1878.          used before the possible replies are "P" for preliminary (not
  1879.          used in SMTP), "I" for intermediate, "S" for success, "F" for
  1880.          failure, and "E" for error.  The 421 reply (service not
  1881.          available, closing transmission channel) may be given to any
  1882.          command if the SMTP-receiver knows it must shut down.  This
  1883.          listing forms the basis for the State Diagrams in Section 4.4.
  1884.  
  1885.             CONNECTION ESTABLISHMENT
  1886.                S: 220
  1887.                F: 421
  1888.             HELO
  1889.                S: 250
  1890.                E: 500, 501, 504, 421
  1891.             MAIL
  1892.                S: 250
  1893.                F: 552, 451, 452
  1894.                E: 500, 501, 421
  1895.  
  1896.  
  1897.  
  1898. Postel                                                         [Page 31]
  1899.  
  1900.  
  1901.                                                                         
  1902. November 1981                                                    RFC 788
  1903. Simple Mail Transfer Protocol                                           
  1904.  
  1905.  
  1906.  
  1907.             RCPT
  1908.                S: 250, 251
  1909.                F: 550, 551, 552, 553, 450, 451, 452
  1910.                E: 500, 501, 421
  1911.             DATA
  1912.                I: 354 -> data -> S: 250
  1913.                                  F: 552, 554, 451, 452
  1914.                F: 451, 554
  1915.                E: 500, 501, 421
  1916.             RSET
  1917.                S: 250
  1918.                E: 500, 501, 504, 421
  1919.             SEND
  1920.                S: 250
  1921.                F: 552, 451, 452
  1922.                E: 500, 501, 502, 421
  1923.             SOML
  1924.                S: 250
  1925.                F: 552, 451, 452
  1926.                E: 500, 501, 502, 421
  1927.             SAML
  1928.                S: 250
  1929.                F: 552, 451, 452
  1930.                E: 500, 501, 502, 421
  1931.             VRFY
  1932.                S: 250
  1933.                F: 550
  1934.                E: 500, 501, 502, 504, 421
  1935.             EXPN
  1936.                S: 250
  1937.                F: 550
  1938.                E: 500, 501, 502, 504, 421
  1939.             HELP
  1940.                S: 211, 214
  1941.                E: 500, 501, 502, 504, 421
  1942.             NOOP
  1943.                S: 250
  1944.                E: 500, 421
  1945.             QUIT
  1946.                S: 221
  1947.                E: 500
  1948.  
  1949.  
  1950.  
  1951.  
  1952.  
  1953.  
  1954.  
  1955.  
  1956. [Page 32]                                                         Postel
  1957.  
  1958.  
  1959.                                                                         
  1960. RFC 788                                                    November 1981
  1961.                                            Simple Mail Transfer Protocol
  1962.  
  1963.  
  1964.  
  1965.    4.4.  STATE DIAGRAMS
  1966.  
  1967.       Following are state diagrams for a simple-minded SMTP
  1968.       implementation.  Only the first digit of the reply codes is used.
  1969.       There is one state diagram for each group of SMTP commands.  The
  1970.       command groupings were determined by constructing a model for each
  1971.       command and then collecting together the commands with
  1972.       structurally identical models.
  1973.  
  1974.       For each command there are three possible outcomes:  "success"
  1975.       (S), "failure" (F), and "error" (E). In the state diagrams below
  1976.       we use the symbol B for "begin", and the symbol W for "wait for
  1977.       reply".
  1978.  
  1979.       First, the diagram that represents most of the SMTP commands:
  1980.  
  1981.          
  1982.                                   1,3    +---+
  1983.                              ----------->| E |
  1984.                             |            +---+
  1985.                             |
  1986.          +---+    cmd    +---+    2      +---+
  1987.          | B |---------->| W |---------->| S |
  1988.          +---+           +---+           +---+
  1989.                             |
  1990.                             |     4,5    +---+
  1991.                              ----------->| F |
  1992.                                          +---+
  1993.          
  1994.  
  1995.          This diagram models the commands:
  1996.  
  1997.             HELO, MAIL, RCPT, RSET, SEND, SOML, SAML, VRFY, EXPN, HELP,
  1998.             NOOP, QUIT.
  1999.  
  2000.  
  2001.  
  2002.  
  2003.  
  2004.  
  2005.  
  2006.  
  2007.  
  2008.  
  2009.  
  2010.  
  2011.  
  2012.  
  2013.  
  2014. Postel                                                         [Page 33]
  2015.  
  2016.  
  2017.                                                                         
  2018. November 1981                                                    RFC 788
  2019. Simple Mail Transfer Protocol                                           
  2020.  
  2021.  
  2022.  
  2023.       A more complex diagram models the DATA command:
  2024.  
  2025.          
  2026.          +---+   DATA    +---+ 1,2                 +---+
  2027.          | B |---------->| W |-------------------->| E |
  2028.          +---+           +---+        ------------>+---+
  2029.                          3| |4,5     |
  2030.                           | |        |
  2031.             --------------   -----   |
  2032.            |                      |  |             +---+
  2033.            |               ----------     -------->| S |
  2034.            |              |       |      |         +---+
  2035.            |              |  ------------
  2036.            |              | |     |
  2037.            V           1,3| |2    |
  2038.          +---+   data    +---+     --------------->+---+
  2039.          |   |---------->| W |                     | F |
  2040.          +---+           +---+-------------------->+---+
  2041.                               4,5
  2042.  
  2043.  
  2044.          Note that the "data" here is a series of lines sent from the
  2045.          sender to the receiver with no response expected until the last
  2046.          line is sent.
  2047.  
  2048.  
  2049.  
  2050.  
  2051.  
  2052.  
  2053.  
  2054.  
  2055.  
  2056.  
  2057.  
  2058.  
  2059.  
  2060.  
  2061.  
  2062.  
  2063.  
  2064.  
  2065.  
  2066.  
  2067.  
  2068.  
  2069.  
  2070.  
  2071.  
  2072. [Page 34]                                                         Postel
  2073.  
  2074.  
  2075.                                                                         
  2076. RFC 788                                                    November 1981
  2077.                                            Simple Mail Transfer Protocol
  2078.  
  2079.  
  2080.  
  2081.    4.5.  DETAILS
  2082.  
  2083.       4.5.1.  MINIMUM IMPLEMENTATION
  2084.  
  2085.          In order to make SMTP workable, the following minimum
  2086.          implementation is required for all receivers:
  2087.  
  2088.             COMMANDS -- HELO
  2089.                         MAIL
  2090.                         RCPT
  2091.                         DATA
  2092.                         RSET
  2093.                         NOOP
  2094.                         QUIT
  2095.  
  2096.       4.5.2.  TRANSPARENCY
  2097.  
  2098.          Without some provision for data transparency the character
  2099.          sequence "<CRLF>.<CRLF>" ends the the mail text and cannot be
  2100.          sent by the user.  In general, users are not aware of such
  2101.          "forbidden" sequences.  To allow all user composed text to be
  2102.          transmitted transparently the following procedures are used.
  2103.  
  2104.             1. Before sending a line of mail text the sender-SMTP checks
  2105.             the first character of the line.  If it is a period, one
  2106.             additional period is inserted at the beginning of the line.
  2107.  
  2108.             2. When a line of mail text is received by the receiver-SMTP
  2109.             it checks the the line.  If the line is composed of a single
  2110.             period it is the end of mail.  If the first character is a
  2111.             period and there are other characters on the line, the first
  2112.             character is deleted.
  2113.  
  2114.          The mail data may contain any of the 128 ASCII characters.  All
  2115.          characters are to be delivered to the recipients mailbox
  2116.          including format effectors and other control characters.  The
  2117.          7-bit ASCII codes are transmitted right justified in 8-bit
  2118.          bytes (octets) with the high order bits cleared to zero.
  2119.  
  2120.             In some systems it may be necessary to transform the data as
  2121.             it is received and stored.  This may be necessary for hosts
  2122.             that use a different character set than ASCII as their local
  2123.             character set, or that store data in records rather than
  2124.             strings.  If such transforms are necessary, they must be
  2125.             reversible -- especially if such transforms are applied to
  2126.             mail being relayed.
  2127.  
  2128.  
  2129.  
  2130. Postel                                                         [Page 35]
  2131.  
  2132.  
  2133.                                                                         
  2134. November 1981                                                    RFC 788
  2135. Simple Mail Transfer Protocol                                           
  2136.  
  2137.  
  2138.  
  2139.       4.5.3.  SIZES
  2140.  
  2141.          There are several objects that have required minimum maximum
  2142.          sizes.  That is every implementation must be able to receive
  2143.          objects of at least these sizes, but must not send objects
  2144.          larger than these sizes.
  2145.  
  2146.                                     
  2147.           ****************************************************
  2148.           *                                                  *
  2149.           *  TO THE MAXIMUM EXTENT POSSIBLE, IMPLEMENTATION  *
  2150.           *  TECHNIQUES WHICH IMPOSE NO LIMITS ON THE LENGTH *
  2151.           *  OF THESE OBJECTS SHOULD BE USED.                *
  2152.           *                                                  *
  2153.           ****************************************************
  2154.  
  2155.             user
  2156.  
  2157.                The maximum total length of a user name is 64 characters.
  2158.  
  2159.             host
  2160.  
  2161.                The maximum total length of a host name or number is 40
  2162.                characters.
  2163.  
  2164.             path
  2165.  
  2166.                The maximum total length of a reverse-path or
  2167.                forward-path is 256 characters (including the punctuation
  2168.                and element separators).
  2169.  
  2170.             command line
  2171.  
  2172.                The maximum total length of a command line including the
  2173.                command word and the <CRLF> is 512 characters.
  2174.  
  2175.             reply line
  2176.  
  2177.                The maximum total length of a reply line including the
  2178.                reply code and the <CRLF> is 512 characters.
  2179.  
  2180.             text line
  2181.  
  2182.                The maximum total length of a text line including the
  2183.                <CRLF> is 1000 characters (but not counting the leading
  2184.                dot duplicated for transparency).
  2185.  
  2186.  
  2187.  
  2188. [Page 36]                                                         Postel
  2189.  
  2190.  
  2191.                                                                         
  2192. RFC 788                                                    November 1981
  2193.                                            Simple Mail Transfer Protocol
  2194.  
  2195.  
  2196.  
  2197.             recipients buffer
  2198.  
  2199.                The maximum total number of recipients that must be
  2200.                buffered is 100 recipients.
  2201.  
  2202.                                     
  2203.           ****************************************************
  2204.           *                                                  *
  2205.           *  TO THE MAXIMUM EXTENT POSSIBLE, IMPLEMENTATION  *
  2206.           *  TECHNIQUES WHICH IMPOSE NO LIMITS ON THE LENGTH *
  2207.           *  OF THESE OBJECTS SHOULD BE USED.                *
  2208.           *                                                  *
  2209.           ****************************************************
  2210.  
  2211.          Errors due to exceeding these limits may be reported by using
  2212.          the reply codes, for example:
  2213.  
  2214.             500 Line too long.
  2215.  
  2216.             501 Path too long
  2217.  
  2218.             552 Too many recipients.
  2219.  
  2220.             552 Too much mail data.
  2221.  
  2222.  
  2223.  
  2224.  
  2225.  
  2226.  
  2227.  
  2228.  
  2229.  
  2230.  
  2231.  
  2232.  
  2233.  
  2234.  
  2235.  
  2236.  
  2237.  
  2238.  
  2239.  
  2240.  
  2241.  
  2242.  
  2243.  
  2244.  
  2245.  
  2246. Postel                                                         [Page 37]
  2247.  
  2248.  
  2249.                                                                         
  2250. November 1981                                                    RFC 788
  2251. Simple Mail Transfer Protocol                                           
  2252.  
  2253.  
  2254.  
  2255. APPENDIX A
  2256.  
  2257.    TCP Transport service
  2258.  
  2259.       The Transmission Control Protocol [3] is used in the ARPA
  2260.       Internet, and in any network following the US DoD standards for
  2261.       internetwork protocols.
  2262.  
  2263.       Connection Establishment
  2264.  
  2265.          The SMTP transmission channel is a TCP connection established
  2266.          between the sender process port U and the receiver process port
  2267.          L.  This single full duplex connection is used as the
  2268.          transmission channel.  This protocol is assigned the service
  2269.          port 25 (31 octal), that is L=25.
  2270.  
  2271.       Data Transfer
  2272.  
  2273.          The TCP connection supports the transmission of 8-bit bytes.
  2274.          The SMTP data is 7-bit ASCII characters.  Each character is
  2275.          transmitted as a 8-bit byte with the high-order bit cleared to
  2276.          zero.
  2277.  
  2278.  
  2279.  
  2280.  
  2281.  
  2282.  
  2283.  
  2284.  
  2285.  
  2286.  
  2287.  
  2288.  
  2289.  
  2290.  
  2291.  
  2292.  
  2293.  
  2294.  
  2295.  
  2296.  
  2297.  
  2298.  
  2299.  
  2300.  
  2301.  
  2302.  
  2303.  
  2304. [Page 38]                                                         Postel
  2305.  
  2306.  
  2307.                                                                         
  2308. RFC 788                                                    November 1981
  2309.                                            Simple Mail Transfer Protocol
  2310.  
  2311.  
  2312.  
  2313. APPENDIX B
  2314.  
  2315.    NCP Transport service
  2316.  
  2317.       The ARPANET Host-to-Host Protocol [4] (implemented by the Network
  2318.       Control Program) may be used in the ARPANET.
  2319.  
  2320.       Connection Establishment
  2321.  
  2322.          The SMTP transmission channel is established via NCP between
  2323.          the the sender process socket U and receiver process socket L.
  2324.          The Initial Connection Protocol [5] is followed resulting in a
  2325.          pair of simplex connections.  This pair of connections is used
  2326.          as the transmission channel.  This protocol is assigned the
  2327.          contact socket 25 (31 octal), that is L=25.
  2328.  
  2329.       Data Transfer
  2330.  
  2331.          The NCP data connections are established in 8-bit byte mode.
  2332.          The SMTP data is 7-bit ASCII characters.  Each character is
  2333.          transmitted as a 8-bit byte with the high-order bit cleared to
  2334.          zero.
  2335.  
  2336.  
  2337.  
  2338.  
  2339.  
  2340.  
  2341.  
  2342.  
  2343.  
  2344.  
  2345.  
  2346.  
  2347.  
  2348.  
  2349.  
  2350.  
  2351.  
  2352.  
  2353.  
  2354.  
  2355.  
  2356.  
  2357.  
  2358.  
  2359.  
  2360.  
  2361.  
  2362. Postel                                                         [Page 39]
  2363.  
  2364.  
  2365.                                                                         
  2366. November 1981                                                    RFC 788
  2367. Simple Mail Transfer Protocol                                           
  2368.  
  2369.  
  2370.  
  2371. APPENDIX C
  2372.  
  2373.    NITS
  2374.  
  2375.       The Network Independent Transport Service [6] may be used.
  2376.  
  2377.       Connection Establishment
  2378.  
  2379.          The SMTP transmission channel is established via NITS between
  2380.          the sender process and receiver process.  The sender process
  2381.          executes the CONNECT primitive, and the waiting receiver
  2382.          process executes the ACCEPT primitive.
  2383.  
  2384.       Data Transfer
  2385.  
  2386.          The NITS connection supports the transmission of 8-bit bytes.
  2387.          The SMTP data is 7-bit ASCII characters.  Each character is
  2388.          transmitted as a 8-bit byte with the high-order bit cleared to
  2389.          zero.
  2390.  
  2391.  
  2392.  
  2393.  
  2394.  
  2395.  
  2396.  
  2397.  
  2398.  
  2399.  
  2400.  
  2401.  
  2402.  
  2403.  
  2404.  
  2405.  
  2406.  
  2407.  
  2408.  
  2409.  
  2410.  
  2411.  
  2412.  
  2413.  
  2414.  
  2415.  
  2416.  
  2417.  
  2418.  
  2419.  
  2420. [Page 40]                                                         Postel
  2421.  
  2422.  
  2423.                                                                         
  2424. RFC 788                                                    November 1981
  2425.                                            Simple Mail Transfer Protocol
  2426.  
  2427.  
  2428.  
  2429. APPENDIX D
  2430.  
  2431.    X.25 Transport service
  2432.  
  2433.       It may be possible to use the X.25 service [7] as provided by the
  2434.       Public Data Networks directly, but there are indications that it
  2435.       is too error prone to qualify as a reliable channel.  It is
  2436.       suggested that a reliable end-to-end protocol such as TCP be used
  2437.       on top of X.25 connections.
  2438.  
  2439.  
  2440.  
  2441.  
  2442.  
  2443.  
  2444.  
  2445.  
  2446.  
  2447.  
  2448.  
  2449.  
  2450.  
  2451.  
  2452.  
  2453.  
  2454.  
  2455.  
  2456.  
  2457.  
  2458.  
  2459.  
  2460.  
  2461.  
  2462.  
  2463.  
  2464.  
  2465.  
  2466.  
  2467.  
  2468.  
  2469.  
  2470.  
  2471.  
  2472.  
  2473.  
  2474.  
  2475.  
  2476.  
  2477.  
  2478. Postel                                                         [Page 41]
  2479.  
  2480.  
  2481.                                                                         
  2482. November 1981                                                    RFC 788
  2483. Simple Mail Transfer Protocol                                           
  2484.  
  2485.  
  2486.  
  2487. APPENDIX E
  2488.  
  2489.    Theory of Reply Codes
  2490.  
  2491.       The three digits of the reply each have a special significance.
  2492.       The first digit denotes whether the response is good, bad or
  2493.       incomplete.  An unsophisticated sender-SMTP will be able to
  2494.       determine its next action (proceed as planned, redo, retrench,
  2495.       etc.) by simply examining this first digit.  A sender-SMTP that
  2496.       wants to know approximately what kind of error occurred (e.g.,
  2497.       mail system error, command syntax error) may examine the second
  2498.       digit, reserving the third digit for the finest gradation of
  2499.       information.
  2500.  
  2501.          There are five values for the first digit of the reply code:
  2502.  
  2503.             1yz   Positive Preliminary reply
  2504.  
  2505.                The command has been accepted, but the requested action
  2506.                is being held in abeyance, pending confirmation of the
  2507.                information in this reply.  The sender-SMTP should send
  2508.                another command specifying whether to continue or abort
  2509.                the action.
  2510.  
  2511.                   [Note: SMTP does not have any commands that allow this
  2512.                   type of reply, and so does not have the continue or
  2513.                   abort commands.]
  2514.  
  2515.             2yz   Positive Completion reply
  2516.  
  2517.                The requested action has been successfully completed.  A
  2518.                new request may be initiated.
  2519.  
  2520.             3yz   Positive Intermediate reply
  2521.  
  2522.                The command has been accepted, but the requested action
  2523.                is being held in abeyance, pending receipt of further
  2524.                information.  The sender-SMTP should send another command
  2525.                specifying this information.  This reply is used in
  2526.                command sequence groups.
  2527.  
  2528.             4yz   Transient Negative Completion reply
  2529.  
  2530.                The command was not accepted and the requested action did
  2531.                not occur.  However, the error condition is temporary and
  2532.                the action may be requested again.  The sender should
  2533.  
  2534.  
  2535.  
  2536. [Page 42]                                                         Postel
  2537.  
  2538.  
  2539.                                                                         
  2540. RFC 788                                                    November 1981
  2541.                                            Simple Mail Transfer Protocol
  2542.  
  2543.  
  2544.  
  2545.                return to the beginning of the command sequence (if any).
  2546.                It is difficult to assign a meaning to "transient" when
  2547.                two different sites (receiver- and sender- SMTPs) must
  2548.                agree on the interpretation.  Each reply in this category
  2549.                might have a different time value, but the sender-SMTP is
  2550.                encouraged to try again.  A rule of thumb to determine if
  2551.                a reply fits into the 4yz or the 5yz category (see below)
  2552.                is that replies are 4yz if they can be repeated without
  2553.                any change in command form or in properties of the sender
  2554.                or receiver.  (E.g., the command is repeated identically
  2555.                and the receiver does not put up a new implementation.)
  2556.  
  2557.             5yz   Permanent Negative Completion reply
  2558.  
  2559.                The command was not accepted and the requested action did
  2560.                not occur.  The sender-SMTP is discouraged from repeating
  2561.                the exact request (in the same sequence).  Even some
  2562.                "permanent" error conditions can be corrected, so the
  2563.                human user may want to direct the sender-SMTP to
  2564.                reinitiate the command sequence by direct action at some
  2565.                point in the future (e.g., after the spelling has been
  2566.                changed, or the user has altered the account status).
  2567.  
  2568.          The second digit encodes responses in specific categories:
  2569.  
  2570.             x0z   Syntax -- These replies refer to syntax errors,
  2571.                   syntactically correct commands that don't fit any
  2572.                   functional category, and unimplemented or superfluous
  2573.                   commands.
  2574.  
  2575.             x1z   Information --  These are replies to requests for
  2576.                   information, such as status or help.
  2577.  
  2578.             x2z   Connections -- These are replies referring to the
  2579.                   transmission channel.
  2580.  
  2581.             x3z   Unspecified as yet.
  2582.  
  2583.             x4z   Unspecified as yet.
  2584.  
  2585.             x5z   Mail system -- These replies indicate the status of
  2586.                   the receiver mail system vis-a-vis the requested
  2587.                   transfer or other mail system action.
  2588.  
  2589.          The third digit gives a finer gradation of meaning in each
  2590.          category specified by the second digit.  The list of replies
  2591.  
  2592.  
  2593.  
  2594. Postel                                                         [Page 43]
  2595.  
  2596.  
  2597.                                                                         
  2598. November 1981                                                    RFC 788
  2599. Simple Mail Transfer Protocol                                           
  2600.  
  2601.  
  2602.  
  2603.          illustrates this.  Each reply text is recommended rather than
  2604.          mandatory, and may even change according to the command with
  2605.          which it is associated.  On the other hand, the reply codes
  2606.          must strictly follow the specifications in this section.
  2607.          Receiver implementations should not invent new codes for
  2608.          slightly different situations from the ones described here, but
  2609.          rather adapt codes already defined.
  2610.  
  2611.          For example, a command such as NOOP whose successful execution
  2612.          does not offer the sender-SMTP any new information will return
  2613.          a 250 reply.  The response is 502 when the command requests an
  2614.          unimplemented non-site-specific action.  A refinement of that
  2615.          is the 504 reply for a command that is implemented, but that
  2616.          requests an unimplemented parameter.
  2617.  
  2618.       The reply text may be longer than a single line; in these cases
  2619.       the complete text must be marked so the sender-SMTP knows when it
  2620.       can stop reading the reply.  This requires a special format to
  2621.       indicate a multiple line reply.
  2622.  
  2623.          The format for multi-line replies requires that every line,
  2624.          except the last, begin with the reply code, followed
  2625.          immediately by a hyphen, "-" (also known as minus), followed by
  2626.          text.  The last line will begin with the reply code, followed
  2627.          immediately by <SP>, optionally some text, and <CRLF>.
  2628.  
  2629.             For example:
  2630.                                 123-First line
  2631.                                 123-Second line
  2632.                                 123-234 text beginning with numbers
  2633.                                 123 The last line
  2634.  
  2635.          The sender-SMTP then simply needs to search for the reply code
  2636.          followed by <SP> at the beginning of a line, and ignore all
  2637.          preceding lines.
  2638.  
  2639.  
  2640.  
  2641.  
  2642.  
  2643.  
  2644.  
  2645.  
  2646.  
  2647.  
  2648.  
  2649.  
  2650.  
  2651.  
  2652. [Page 44]                                                         Postel
  2653.  
  2654.  
  2655.                                                                         
  2656. RFC 788                                                    November 1981
  2657.                                            Simple Mail Transfer Protocol
  2658.  
  2659.  
  2660.  
  2661. APPENDIX F
  2662.  
  2663.    Scenarios
  2664.  
  2665.       This section presents complete scenarios of several types of SMTP
  2666.       sessions.
  2667.  
  2668.    A Typical SMTP Transaction Scenario
  2669.  
  2670.       This SMTP example shows mail sent by Smith at host USC-ISIF, to
  2671.       Jones, Green, and Brown at host BBN-UNIX.  Here we assume that
  2672.       host USC-ISIF contacts host BBN-UNIX directly.  The mail is
  2673.       accepted for Jones and Brown.  Green does not have a mailbox at
  2674.       host BBN-UNIX.
  2675.  
  2676.       -------------------------------------------------------------
  2677.  
  2678.          R: 220 BBN-UNIX Simple Mail Transfer Service Ready
  2679.          S: HELO USC-ISIF
  2680.          R: 250 BBN-UNIX
  2681.  
  2682.          S: MAIL FROM:<Smith@USC-ISIF>
  2683.          R: 250 OK
  2684.  
  2685.          S: RCPT TO:<Jones@BBN-UNIX>
  2686.          R: 250 OK
  2687.  
  2688.          S: RCPT TO:<Green@BBN-UNIX>
  2689.          R: 550 No such user here
  2690.  
  2691.          S: RCPT TO:<Brown@BBN-UNIX>
  2692.          R: 250 OK
  2693.  
  2694.          S: DATA
  2695.          R: 354 Start mail input; end with <CRLF>.<CRLF>
  2696.          S: Blah blah blah...
  2697.          S: ...etc. etc. etc.
  2698.          S: .
  2699.          R: 250 OK
  2700.  
  2701.          S: QUIT
  2702.          R: 221 BBN-UNIX Service closing transmission channel
  2703.  
  2704.                                Scenario 1
  2705.  
  2706.       -------------------------------------------------------------
  2707.  
  2708.  
  2709.  
  2710. Postel                                                         [Page 45]
  2711.  
  2712.  
  2713.                                                                         
  2714. November 1981                                                    RFC 788
  2715. Simple Mail Transfer Protocol                                           
  2716.  
  2717.  
  2718.  
  2719.    Aborted SMTP Transaction Scenario
  2720.  
  2721.       -------------------------------------------------------------
  2722.  
  2723.          R: 220 MIT-Multics Simple Mail Transfer Service Ready
  2724.          S: HELO ISI-VAXA
  2725.          R: 250 MIT-Multics
  2726.  
  2727.          S: MAIL FROM:<Smith@ISI-VAXA>
  2728.          R: 250 OK
  2729.  
  2730.          S: RCPT TO:<Jones@MIT-Multics>
  2731.          R: 250 OK
  2732.  
  2733.          S: RCPT TO:<Green@MIT-Multics>
  2734.          R: 550 No such user here
  2735.  
  2736.          S: RSET
  2737.          R: 250 OK
  2738.  
  2739.          S: QUIT
  2740.          R: 221 MIT-Multics Service closing transmission channel
  2741.  
  2742.                                Scenario 2
  2743.  
  2744.       -------------------------------------------------------------
  2745.  
  2746.  
  2747.  
  2748.  
  2749.  
  2750.  
  2751.  
  2752.  
  2753.  
  2754.  
  2755.  
  2756.  
  2757.  
  2758.  
  2759.  
  2760.  
  2761.  
  2762.  
  2763.  
  2764.  
  2765.  
  2766.  
  2767.  
  2768. [Page 46]                                                         Postel
  2769.  
  2770.  
  2771.                                                                         
  2772. RFC 788                                                    November 1981
  2773.                                            Simple Mail Transfer Protocol
  2774.  
  2775.  
  2776.  
  2777.    Relayed Mail Scenario
  2778.  
  2779.       -------------------------------------------------------------
  2780.  
  2781.          Step 1  --  Source Host to Relay Host
  2782.  
  2783.             R: 220 USC-ISIE Simple Mail Transfer Service Ready
  2784.             S: HELO MIT-AI
  2785.             R: 250 USC-ISIE
  2786.  
  2787.             S: MAIL FROM:<JQP@MIT-AI>
  2788.             R: 250 OK
  2789.  
  2790.             S: RCPT TO:<@ISIE,Jones@BBN-VAX>
  2791.             R: 250 OK
  2792.  
  2793.             S: DATA
  2794.             R: 354 Start mail input; end with <CRLF>.<CRLF>
  2795.             S: Date: 2-Nov-81 22:33:44
  2796.             S: From: John Q. Public <JQP at MIT-AI>
  2797.             S: Subject:  The Next Meeting of the Board
  2798.             S: To: Jones at BBN-Vax
  2799.             S:
  2800.             S: Bill:
  2801.             S: The next meeting of the board of directors will be
  2802.             S: on Tuesday.
  2803.             S:                                              John.
  2804.             S: .
  2805.             R: 250 OK
  2806.  
  2807.             S: QUIT
  2808.             R: 221 USC-ISIE Service closing transmission channel
  2809.  
  2810.  
  2811.  
  2812.  
  2813.  
  2814.  
  2815.  
  2816.  
  2817.  
  2818.  
  2819.  
  2820.  
  2821.  
  2822.  
  2823.  
  2824.  
  2825.  
  2826. Postel                                                         [Page 47]
  2827.  
  2828.  
  2829.                                                                         
  2830. November 1981                                                    RFC 788
  2831. Simple Mail Transfer Protocol                                           
  2832.  
  2833.  
  2834.  
  2835.          Step 2  --  Relay Host to Destination Host
  2836.  
  2837.             R: 220 BBN-VAX Simple Mail Transfer Service Ready
  2838.             S: HELO USC-ISIE
  2839.             R: 250 BBN-VAX
  2840.  
  2841.             S: MAIL FROM:<@ISIE,JQP@MIT-AI>
  2842.             R: 250 OK
  2843.  
  2844.             S: RCPT TO:<Jones@BBN-VAX>
  2845.             R: 250 OK
  2846.  
  2847.             S: DATA
  2848.             R: 354 Start mail input; end with <CRLF>.<CRLF>
  2849.             S: Mail-From: NCP host MIT-AI received by USC-ISIE at
  2850.                2-Nov-81 22:40:10
  2851.             S: Date: 2-Nov-81 22:33:44
  2852.             S: From: John Q. Public <JQP at MIT-AI>
  2853.             S: Subject:  The Next Meeting of the Board
  2854.             S: To: Jones at BBN-Vax
  2855.             S:
  2856.             S: Bill:
  2857.             S: The next meeting of the board of directors will be
  2858.             S: on Tuesday.
  2859.             S:                                              John.
  2860.             S: .
  2861.             R: 250 OK
  2862.  
  2863.             S: QUIT
  2864.             R: 221 USC-ISIE Service closing transmission channel
  2865.  
  2866.                                Scenario 3
  2867.  
  2868.       -------------------------------------------------------------
  2869.  
  2870.  
  2871.  
  2872.  
  2873.  
  2874.  
  2875.  
  2876.  
  2877.  
  2878.  
  2879.  
  2880.  
  2881.  
  2882.  
  2883.  
  2884. [Page 48]                                                         Postel
  2885.  
  2886.  
  2887.                                                                         
  2888. RFC 788                                                    November 1981
  2889.                                            Simple Mail Transfer Protocol
  2890.  
  2891.  
  2892.  
  2893.    Verifying and Sending Scenario
  2894.  
  2895.       -------------------------------------------------------------
  2896.  
  2897.          R: 220 SU-SCORE Simple Mail Transfer Service Ready
  2898.          S: HELO MIT-MC
  2899.          R: 250 SU-SCORE
  2900.  
  2901.          S: VRFY Crispin
  2902.          R: 250 Mark Crispin <Admin.MRC@SU-SCORE>
  2903.  
  2904.          S: SEND FROM:<EAK@MIT-MC>
  2905.          R: 250 OK
  2906.  
  2907.          S: RCPT TO:<Admin.MRC@SU-SCORE>
  2908.          R: 250 OK
  2909.  
  2910.          S: DATA
  2911.          R: 354 Start mail input; end with <CRLF>.<CRLF>
  2912.          S: Blah blah blah...
  2913.          S: ...etc. etc. etc.
  2914.          S: .
  2915.          R: 250 OK
  2916.  
  2917.          S: QUIT
  2918.          R: 221 SU-SCORE Service closing transmission channel
  2919.  
  2920.                                Scenario 4
  2921.  
  2922.       -------------------------------------------------------------
  2923.  
  2924.  
  2925.  
  2926.  
  2927.  
  2928.  
  2929.  
  2930.  
  2931.  
  2932.  
  2933.  
  2934.  
  2935.  
  2936.  
  2937.  
  2938.  
  2939.  
  2940.  
  2941.  
  2942. Postel                                                         [Page 49]
  2943.  
  2944.  
  2945.                                                                         
  2946. November 1981                                                    RFC 788
  2947. Simple Mail Transfer Protocol                                           
  2948.  
  2949.  
  2950.  
  2951.    Sending and Mailing Scenarios
  2952.  
  2953.       First the user's name is verified, then  an attempt is made to
  2954.       send to the user's terminal.  When that fails, the messages is
  2955.       mailed to the user's mailbox.
  2956.  
  2957.       -------------------------------------------------------------
  2958.  
  2959.          R: 220 SU-SCORE Simple Mail Transfer Service Ready
  2960.          S: HELO MIT-MC
  2961.          R: 250 SU-SCORE
  2962.  
  2963.          S: VRFY Crispin
  2964.          R: 250 Mark Crispin <Admin.MRC@SU-SCORE>
  2965.  
  2966.          S: SEND FROM:<EAK@MIT-MC>
  2967.          R: 250 OK
  2968.  
  2969.          S: RCPT TO:<Admin.MRC@SU-SCORE>
  2970.          R: 450 User not active now
  2971.  
  2972.          S: RSET
  2973.          R: 250 OK
  2974.  
  2975.          S: MAIL FROM:<EAK@MIT-MC>
  2976.          R: 250 OK
  2977.  
  2978.          S: RCPT TO:<Admin.MRC@SU-SCORE>
  2979.          R: 250 OK
  2980.  
  2981.          S: DATA
  2982.          R: 354 Start mail input; end with <CRLF>.<CRLF>
  2983.          S: Blah blah blah...
  2984.          S: ...etc. etc. etc.
  2985.          S: .
  2986.          R: 250 OK
  2987.  
  2988.          S: QUIT
  2989.          R: 221 SU-SCORE Service closing transmission channel
  2990.  
  2991.                                Scenario 5
  2992.  
  2993.       -------------------------------------------------------------
  2994.  
  2995.  
  2996.  
  2997.  
  2998.  
  2999.  
  3000. [Page 50]                                                         Postel
  3001.  
  3002.  
  3003.                                                                         
  3004. RFC 788                                                    November 1981
  3005.                                            Simple Mail Transfer Protocol
  3006.  
  3007.  
  3008.  
  3009.       Doing the preceding scenario more efficiently.
  3010.  
  3011.       -------------------------------------------------------------
  3012.  
  3013.          R: 220 SU-SCORE Simple Mail Transfer Service Ready
  3014.          S: HELO MIT-MC
  3015.          R: 250 SU-SCORE
  3016.  
  3017.          S: VRFY Crispin
  3018.          R: 250 Mark Crispin <Admin.MRC@SU-SCORE>
  3019.  
  3020.          S: SOML FROM:<EAK@MIT-MC>
  3021.          R: 250 OK
  3022.  
  3023.          S: RCPT TO:<Admin.MRC@SU-SCORE>
  3024.          R: 250 User not active now, so will do mail.
  3025.  
  3026.          S: DATA
  3027.          R: 354 Start mail input; end with <CRLF>.<CRLF>
  3028.          S: Blah blah blah...
  3029.          S: ...etc. etc. etc.
  3030.          S: .
  3031.          R: 250 OK
  3032.  
  3033.          S: QUIT
  3034.          R: 221 SU-SCORE Service closing transmission channel
  3035.  
  3036.                                Scenario 6
  3037.  
  3038.       -------------------------------------------------------------
  3039.  
  3040.  
  3041.  
  3042.  
  3043.  
  3044.  
  3045.  
  3046.  
  3047.  
  3048.  
  3049.  
  3050.  
  3051.  
  3052.  
  3053.  
  3054.  
  3055.  
  3056.  
  3057.  
  3058. Postel                                                         [Page 51]
  3059.  
  3060.  
  3061.                                                                         
  3062. November 1981                                                    RFC 788
  3063. Simple Mail Transfer Protocol                                           
  3064.  
  3065.  
  3066.  
  3067.    Mailing List Scenario
  3068.  
  3069.       First each of two mailing lists are expanded in separate sessions
  3070.       with different hosts.  Then the message is sent to everyone that
  3071.       appeared on either list (but no duplicates) via a relay host.
  3072.  
  3073.       -------------------------------------------------------------
  3074.  
  3075.          Step 1  --  Expanding the First List
  3076.  
  3077.             R: 220 MIT-AI Simple Mail Transfer Service Ready
  3078.             S: HELO SU-SCORE
  3079.             R: 250 MIT-AI
  3080.  
  3081.             S: EXPN Example-People
  3082.             R: 250-<ABC@MIT-MC>
  3083.             R: 250-Fred Fonebone <Fonebone@ISIQ>
  3084.             R: 250-Xenon Y. Zither <XYZ@MIT-AI>
  3085.             R: 250-Quincy Smith <@ISIF,Q-Smith@ISI-VAXA>
  3086.             R: 250-<joe@foo-unix>
  3087.             R: 250 <xyz@bar-unix>
  3088.  
  3089.             S: QUIT
  3090.             R: 221 MIT-AI Service closing transmission channel
  3091.  
  3092.  
  3093.  
  3094.  
  3095.  
  3096.  
  3097.  
  3098.  
  3099.  
  3100.  
  3101.  
  3102.  
  3103.  
  3104.  
  3105.  
  3106.  
  3107.  
  3108.  
  3109.  
  3110.  
  3111.  
  3112.  
  3113.  
  3114.  
  3115.  
  3116. [Page 52]                                                         Postel
  3117.  
  3118.  
  3119.                                                                         
  3120. RFC 788                                                    November 1981
  3121.                                            Simple Mail Transfer Protocol
  3122.  
  3123.  
  3124.  
  3125.          Step 2  --  Expanding the Second List
  3126.  
  3127.             R: 220 MIT-MC Simple Mail Transfer Service Ready
  3128.             S: HELO SU-SCORE
  3129.             R: 250 MIT-MC
  3130.  
  3131.             S: EXPN Interested-Parties
  3132.             R: 250-Al Calico <ABC@MIT-MC>
  3133.             R: 250-<XYZ@MIT-AI>
  3134.             R: 250-Quincy Smith <@ISIF,Q-Smith@ISI-VAXA>
  3135.             R: 250-<fred@BBN-UNIX>
  3136.             R: 250 <xyz@bar-unix>
  3137.  
  3138.             S: QUIT
  3139.             R: 221 MIT-MC Service closing transmission channel
  3140.  
  3141.  
  3142.  
  3143.  
  3144.  
  3145.  
  3146.  
  3147.  
  3148.  
  3149.  
  3150.  
  3151.  
  3152.  
  3153.  
  3154.  
  3155.  
  3156.  
  3157.  
  3158.  
  3159.  
  3160.  
  3161.  
  3162.  
  3163.  
  3164.  
  3165.  
  3166.  
  3167.  
  3168.  
  3169.  
  3170.  
  3171.  
  3172.  
  3173.  
  3174. Postel                                                         [Page 53]
  3175.  
  3176.  
  3177.                                                                         
  3178. November 1981                                                    RFC 788
  3179. Simple Mail Transfer Protocol                                           
  3180.  
  3181.  
  3182.  
  3183.          Step 3  --  Mailing to All via a Relay Host
  3184.  
  3185.             R: 220 USC-ISIE Simple Mail Transfer Service Ready
  3186.             S: HELO SU-SCORE
  3187.             R: 250 USC-ISIE
  3188.  
  3189.             S: MAIL FROM:<Account.Person@SU-SCORE>
  3190.             R: 250 OK
  3191.             S: RCPT TO:<@ISIE,ABC@MIT-MC>
  3192.             R: 250 OK
  3193.             S: RCPT TO:<@ISIE,Fonebone@ISIQ>
  3194.             R: 250 OK
  3195.             S: RCPT TO:<@ISIE,XYZ@MIT-AI>
  3196.             R: 250 OK
  3197.             S: RCPT TO:<@ISIE,@ISIF,Q-Smith@ISI-VAXA>
  3198.             R: 250 OK
  3199.             S: RCPT TO:<@ISIE,joe@FOO-UNIX>
  3200.             R: 250 OK
  3201.             S: RCPT TO:<@ISIE,xyz@BAR-UNIX>
  3202.             R: 250 OK
  3203.             S: RCPT TO:<@ISIE,fred@BBN-UNIX>
  3204.             R: 250 OK
  3205.  
  3206.             S: DATA
  3207.             R: 354 Start mail input; end with <CRLF>.<CRLF>
  3208.             S: Blah blah blah...
  3209.             S: ...etc. etc. etc.
  3210.             S: .
  3211.             R: 250 OK
  3212.  
  3213.             S: QUIT
  3214.             R: 221 USC-ISIE Service closing transmission channel
  3215.  
  3216.                                Scenario 7
  3217.  
  3218.       -------------------------------------------------------------
  3219.  
  3220.  
  3221.  
  3222.  
  3223.  
  3224.  
  3225.  
  3226.  
  3227.  
  3228.  
  3229.  
  3230.  
  3231.  
  3232. [Page 54]                                                         Postel
  3233.  
  3234.  
  3235.                                                                         
  3236. RFC 788                                                    November 1981
  3237.                                            Simple Mail Transfer Protocol
  3238.  
  3239.  
  3240.  
  3241.    Forwarding Scenarios
  3242.  
  3243.       -------------------------------------------------------------
  3244.  
  3245.          R: 220 USC-ISIF Simple Mail Transfer Service Ready
  3246.          S: HELO LBL-UNIX
  3247.          R: 250 USC-ISIF
  3248.  
  3249.          S: MAIL FROM:<mo@LBL-UNIX>
  3250.          R: 250 OK
  3251.  
  3252.          S: RCPT TO:<fred@USC-ISIF>
  3253.          R: 251 User not local; will forward to <Jones@USC-ISIA>
  3254.  
  3255.          S: DATA
  3256.          R: 354 Start mail input; end with <CRLF>.<CRLF>
  3257.          S: Blah blah blah...
  3258.          S: ...etc. etc. etc.
  3259.          S: .
  3260.          R: 250 OK
  3261.  
  3262.          S: QUIT
  3263.          R: 221 USC-ISIF Service closing transmission channel
  3264.  
  3265.                                Scenario 8
  3266.  
  3267.       -------------------------------------------------------------
  3268.  
  3269.  
  3270.  
  3271.  
  3272.  
  3273.  
  3274.  
  3275.  
  3276.  
  3277.  
  3278.  
  3279.  
  3280.  
  3281.  
  3282.  
  3283.  
  3284.  
  3285.  
  3286.  
  3287.  
  3288.  
  3289.  
  3290. Postel                                                         [Page 55]
  3291.  
  3292.  
  3293.                                                                         
  3294. November 1981                                                    RFC 788
  3295. Simple Mail Transfer Protocol                                           
  3296.  
  3297.  
  3298.  
  3299.       -------------------------------------------------------------
  3300.  
  3301.          Step 1  --  Trying the Mailbox at the First Host
  3302.  
  3303.             R: 220 USC-ISIF Simple Mail Transfer Service Ready
  3304.             S: HELO LBL-UNIX
  3305.             R: 250 USC-ISIF
  3306.  
  3307.             S: MAIL FROM:<mo@LBL-UNIX>
  3308.             R: 250 OK
  3309.  
  3310.             S: RCPT TO:<fred@USC-ISIF>
  3311.             R: 251 User not local; will forward to <Jones@USC-ISIA>
  3312.  
  3313.             S: RSET
  3314.             R: 250 OK
  3315.  
  3316.             S: QUIT
  3317.             R: 221 USC-ISIF Service closing transmission channel
  3318.  
  3319.          Step 2  --  Delivering the Mail at the Second Host
  3320.  
  3321.             R: 220 USC-ISIA Simple Mail Transfer Service Ready
  3322.             S: HELO LBL-UNIX
  3323.             R: 250 USC-ISIA
  3324.  
  3325.             S: MAIL FROM:<mo@LBL-UNIX>
  3326.             R: 250 OK
  3327.  
  3328.             S: RCPT TO:<Jones@USC-ISIA>
  3329.             R: OK
  3330.  
  3331.             S: DATA
  3332.             R: 354 Start mail input; end with <CRLF>.<CRLF>
  3333.             S: Blah blah blah...
  3334.             S: ...etc. etc. etc.
  3335.             S: .
  3336.             R: 250 OK
  3337.  
  3338.             S: QUIT
  3339.             R: 221 USC-ISIA Service closing transmission channel
  3340.  
  3341.                                Scenario 9
  3342.  
  3343.       -------------------------------------------------------------
  3344.  
  3345.  
  3346.  
  3347.  
  3348. [Page 56]                                                         Postel
  3349.  
  3350.  
  3351.                                                                         
  3352. RFC 788                                                    November 1981
  3353.                                            Simple Mail Transfer Protocol
  3354.  
  3355.  
  3356.  
  3357.    Too Many Recipients Scenario
  3358.  
  3359.       -------------------------------------------------------------
  3360.  
  3361.          R: 220 BERKELEY Simple Mail Transfer Service Ready
  3362.          S: HELO USC-ISIF
  3363.          R: 250 BERKELEY
  3364.  
  3365.          S: MAIL FROM:<Postel@USC-ISIF>
  3366.          R: 250 OK
  3367.  
  3368.          S: RCPT TO:<fabry@BERKELEY>
  3369.          R: 250 OK
  3370.  
  3371.          S: RCPT TO:<eric@BERKELEY>
  3372.          R: 552 Recipient storage full, try again in another transaction
  3373.  
  3374.          S: DATA
  3375.          R: 354 Start mail input; end with <CRLF>.<CRLF>
  3376.          S: Blah blah blah...
  3377.          S: ...etc. etc. etc.
  3378.          S: .
  3379.          R: 250 OK
  3380.  
  3381.          S: MAIL FROM:<Postel@USC-ISIF>
  3382.          R: 250 OK
  3383.  
  3384.          S: RCPT TO:<eric@BERKELEY>
  3385.          R: 250 OK
  3386.  
  3387.          S: DATA
  3388.          R: 354 Start mail input; end with <CRLF>.<CRLF>
  3389.          S: Blah blah blah...
  3390.          S: ...etc. etc. etc.
  3391.          S: .
  3392.          R: 250 OK
  3393.  
  3394.          S: QUIT
  3395.          R: 221 BERKELEY Service closing transmission channel
  3396.  
  3397.                               Scenario 10
  3398.  
  3399.       -------------------------------------------------------------
  3400.  
  3401.  
  3402.  
  3403.  
  3404.  
  3405.  
  3406. Postel                                                         [Page 57]
  3407.  
  3408.  
  3409.                                                                         
  3410. November 1981                                                    RFC 788
  3411. Simple Mail Transfer Protocol                                           
  3412.  
  3413.  
  3414.  
  3415. GLOSSARY
  3416.  
  3417.    ASCII
  3418.  
  3419.       American Standard Code for Information Interchange [1].
  3420.  
  3421.    command
  3422.  
  3423.       A request for a mail service action sent by the sender-SMTP to the
  3424.       receiver-SMTP.
  3425.  
  3426.    end of mail data indication
  3427.  
  3428.       A special sequence of characters that indicates the end of the
  3429.       mail data.  In particular, the five characters carriage return,
  3430.       line feed, period, carriage return, line feed, in that order.
  3431.  
  3432.    host
  3433.  
  3434.       A computer in the internetwork environment on which mailboxes or
  3435.       SMTP processes reside.
  3436.  
  3437.    line
  3438.  
  3439.       A line of text ending with a <CRLF>.
  3440.  
  3441.    mail data
  3442.  
  3443.       A sequence of ASCII characters of arbitrary length, which conforms
  3444.       to the standard set in the Standard for the Format of ARPA Network
  3445.       Text Messages (RFC 733 [2]).
  3446.  
  3447.    mailbox
  3448.  
  3449.       A character string (address) which identifies a user to whom mail
  3450.       is to be sent.  Mailbox normally consists of the host and user
  3451.       specifications.  The standard mailbox naming convention is defined
  3452.       to be "user@host".  Additionally, the "container" in which mail is
  3453.       stored.
  3454.  
  3455.    receiver-SMTP process
  3456.  
  3457.       A process which transfers mail in cooperation with a sender-SMTP
  3458.       process.  It waits for a connection to be established via the
  3459.       transport service.  It receives SMTP commands from the
  3460.       sender-SMTP, sends replies, and performs the specified operations.
  3461.  
  3462.  
  3463.  
  3464. [Page 58]                                                         Postel
  3465.  
  3466.  
  3467.                                                                         
  3468. RFC 788                                                    November 1981
  3469.                                            Simple Mail Transfer Protocol
  3470.  
  3471.  
  3472.  
  3473.    reply
  3474.  
  3475.       A reply is an acknowledgment (positive or negative) sent from
  3476.       receiver to sender via the transmission channel in response to a
  3477.       SMTP command.  The general form of a reply is a completion code
  3478.       (including error codes) followed by a text string.  The codes are
  3479.       for use by programs and the text is usually intended for human
  3480.       users.
  3481.  
  3482.    sender-SMTP process
  3483.  
  3484.       A process which transfers mail in cooperation with a receiver-SMTP
  3485.       process.  A local language may be used in the user interface
  3486.       command/reply dialogue.  The sender-SMTP initiates the transport
  3487.       service connection.  It initiates SMTP commands, receives replies,
  3488.       and governs the transfer of mail.
  3489.  
  3490.    session
  3491.  
  3492.       The set of exchanges that occur while the transmission channel is
  3493.       open.
  3494.  
  3495.    transaction
  3496.  
  3497.       The set of exchanges required for one message to be transmitted
  3498.       for one or more recipients.
  3499.  
  3500.    transmission channel
  3501.  
  3502.       A full-duplex communication path between a sender-SMTP and a
  3503.       receiver-SMTP for the exchange of commands, replies, and mail
  3504.       text.
  3505.  
  3506.    transport service
  3507.  
  3508.       Any reliable stream-oriented data communication services.  For
  3509.       example, NCP, TCP, NITS.
  3510.  
  3511.    user
  3512.  
  3513.       A human being (or a process on behalf of a human being) wishing to
  3514.       obtain mail transfer service.  In addition, a recipient of
  3515.       computer mail.
  3516.  
  3517.  
  3518.  
  3519.  
  3520.  
  3521.  
  3522. Postel                                                         [Page 59]
  3523.  
  3524.  
  3525.                                                                         
  3526. November 1981                                                    RFC 788
  3527. Simple Mail Transfer Protocol                                           
  3528.  
  3529.  
  3530.  
  3531.    word
  3532.  
  3533.       A sequence of printing characters.
  3534.  
  3535.    <CRLF>
  3536.  
  3537.       The characters carriage return and line feed (in that order).
  3538.  
  3539.    <SP>
  3540.  
  3541.       The space character.
  3542.  
  3543.  
  3544.  
  3545.  
  3546.  
  3547.  
  3548.  
  3549.  
  3550.  
  3551.  
  3552.  
  3553.  
  3554.  
  3555.  
  3556.  
  3557.  
  3558.  
  3559.  
  3560.  
  3561.  
  3562.  
  3563.  
  3564.  
  3565.  
  3566.  
  3567.  
  3568.  
  3569.  
  3570.  
  3571.  
  3572.  
  3573.  
  3574.  
  3575.  
  3576.  
  3577.  
  3578.  
  3579.  
  3580. [Page 60]                                                         Postel
  3581.  
  3582.  
  3583.                                                                         
  3584. RFC 788                                                    November 1981
  3585.                                            Simple Mail Transfer Protocol
  3586.  
  3587.  
  3588.  
  3589. REFERENCES
  3590.  
  3591.    [1]  ASCII
  3592.  
  3593.       ASCII, "USA Code for Information Interchange", United States of
  3594.       America Standards Institute, X3.4, 1968.  Also in:  Feinler, E.
  3595.       and J. Postel, eds., "ARPANET Protocol Handbook", NIC 7104, for
  3596.       the Defense Communications Agency by SRI International, Menlo
  3597.       Park, California, Revised January 1978.
  3598.  
  3599.    [2]  RFC 733
  3600.  
  3601.       Crocker, D., J. Vittal, K. Pogran, and D. Henderson, "Standard for
  3602.       the Format of ARPA Network Text Messages," RFC 733, NIC 41952,
  3603.       November 1977.  Also in:  Feinler, E. and J. Postel, eds.,
  3604.       "ARPANET Protocol Handbook", NIC 7104, for the Defense
  3605.       Communications Agency by SRI International, Menlo Park,
  3606.       California, Revised January 1978.
  3607.  
  3608.    [3]  TCP
  3609.  
  3610.       Postel, J., ed., "Transmission Control Protocol - DARPA Internet
  3611.       Program Protocol Specification", RFC 793, USC/Information Sciences
  3612.       Institute, September 1981.
  3613.  
  3614.    [4]  NCP
  3615.  
  3616.       McKenzie,A., "Host/Host Protocol for the ARPA Network", NIC 8246,
  3617.       January 1972.  Also in:  Feinler, E. and J. Postel, eds., "ARPANET
  3618.       Protocol Handbook", NIC 7104, for the Defense Communications
  3619.       Agency by SRI International, Menlo Park, California, Revised
  3620.       January 1978.
  3621.  
  3622.    [5]  Initial Connection Protocol
  3623.  
  3624.       Postel, J., "Official Initial Connection Protocol", NIC 7101,
  3625.       11 June 1971.  Also in:  Feinler, E. and J. Postel, eds., "ARPANET
  3626.       Protocol Handbook", NIC 7104, for the Defense Communications
  3627.       Agency by SRI International, Menlo Park, California, Revised
  3628.       January 1978.
  3629.  
  3630.    [6]  NITS
  3631.  
  3632.       PSS/SG3, "A Network Independent Transport Service", Study Group 3,
  3633.       The Post Office PSS Users Group, February 1980.  Available from
  3634.       the DCPU, National Physical Laboratory, Teddington, UK.
  3635.  
  3636.  
  3637.  
  3638. Postel                                                         [Page 61]
  3639.  
  3640.  
  3641.                                                                         
  3642. November 1981                                                    RFC 788
  3643. Simple Mail Transfer Protocol                                           
  3644.  
  3645.  
  3646.  
  3647.    [7]  X.25
  3648.  
  3649.       CCITT, "Recommendation X.25 - Interface Between Data Terminal
  3650.       Equipment (DTE) and Data Circuit-terminating Equipment (DCE) for
  3651.       Terminals Operating in the Packet Mode on Public Data Networks,"
  3652.       CCITT Orange Book, Vol. VIII.2, International Telephone and
  3653.       Telegraph Consultative Committee, Geneva, 1976.
  3654.  
  3655.          
  3656.  
  3657.  
  3658.  
  3659.  
  3660.  
  3661.  
  3662.  
  3663.  
  3664.  
  3665.  
  3666.  
  3667.  
  3668.  
  3669.  
  3670.  
  3671.  
  3672.  
  3673.  
  3674.  
  3675.  
  3676.  
  3677.  
  3678.  
  3679.  
  3680.  
  3681.  
  3682.  
  3683.  
  3684.  
  3685.  
  3686.  
  3687.  
  3688.  
  3689.  
  3690.  
  3691.  
  3692.  
  3693.  
  3694.  
  3695.  
  3696. [Page 62]                                                         Postel
  3697.  
  3698.