]> Pileus Git - ~andy/fetchmail/blob - RFC/rfc937.txt
Add files from ESR's dev directory that weren't under version control
[~andy/fetchmail] / RFC / rfc937.txt
1
2
3 Network Working Group                                          M. Butler
4 Request for Comments: 937                                      J. Postel
5                                                                 D. Chase
6                                                            J. Goldberger
7                                                           J. K. Reynolds
8 Obsoletes: RFC 918                                                   ISI
9                                                            February 1985
10
11
12                     POST OFFICE PROTOCOL - VERSION 2
13
14
15 Status of this Memo
16
17    This RFC suggests a simple method for workstations to dynamically
18    access mail from a mailbox server.  This RFC specifies a proposed
19    protocol for the ARPA-Internet community, and requests discussion and
20    suggestions for improvement.  This memo is a revision of RFC 918.
21    Distribution of this memo is unlimited.
22
23 Introduction
24
25    The intent of the Post Office Protocol Version 2 (POP2) is to allow a
26    user's workstation to access mail from a mailbox server.  It is
27    expected that mail will be posted from the workstation to the mailbox
28    server via the Simple Mail Transfer Protocol (SMTP).  For further
29    information see RFC-821 [1] and RFC-822 [2].
30
31    This protocol assumes a reliable data stream such as provided by TCP
32    or any similar protocol.  When TCP is used, the POP2 server listens
33    on port 109 [4].
34
35 System Model and Philosophy
36
37    While we view the workstation as an Internet host in the sense that
38    it implements IP, we do not expect the workstation to contain the
39    user's mailbox.  We expect the mailbox to be on a server machine.
40
41    We believe it is important for the mailbox to be on an "always up"
42    machine and that a workstation may be frequently powered down, or
43    otherwise unavailable as an SMTP server.
44
45    POP2 is designed for an environment of workstations and servers on a
46    low-delay, high-throughput, local networks (such as Ethernets).  POP2
47    may be useful in other environments as well, but if the environment
48    is substantially different, a different division of labor between the
49    client and server may be appropriate, and a different protocol
50    required.
51
52    Suppose the user's real name is John Smith, the user's machine is
53    called FIDO, and that the mailbox server is called DOG-HOUSE.  Then
54
55
56
57 Butler, et. al.                                                 [Page 1]
58 \f
59
60
61 RFC 937                                                    February 1985
62 Post Office Protocol
63
64
65    we expect the user's mail to be addressed to JSmith@DOG-HOUSE.ARPA
66    (not JSmith@FIDO.ARPA).
67
68    That is, the destination of the mail is the mailbox on the server
69    machine.  The POP2 protocol and the workstation are merely a
70    mechanism for viewing the messages in the mailbox.
71
72    The user is not tied to any particular workstation for accessing his
73    mail.  The workstation does not appear as any part of the mailbox
74    address.
75
76    This is a very simple protocol.  This is not a user interface.  We
77    expect that there is a program in the workstation that is friendly to
78    the user.  This protocol is not "user friendly".  One basic rule of
79    this protocol is "if anything goes wrong close the connection".
80    Another basic rule is to have few options.
81
82    POP2 does not parse messages in any way.  It does not analyze message
83    headers (Date:, From:, To:, Cc:, or Subject:).  POP2 simply transmits
84    whole messages from a mailbox server to a client workstation.
85
86 The Protocol
87
88    The POP2 protocol is a sequence of commands and replies.  The design
89    draws from many previous protocols of the ARPA-Internet community.
90
91       The server must be listening for a connection.  When a connection
92       is opened the server sends a greeting message and waits for
93       commands.  When commands are received the server acts on them and
94       responds with replies.
95
96       The client opens a connection, waits for the greeting, then sends
97       the HELO command with the user name and password arguments to
98       establish authorization to access mailboxes.  The server returns
99       the number of messages in the default mailbox.
100
101       The client may read the default mailbox associated with the user
102       name or may select another mailbox by using the FOLD command.  The
103       server returns the number of messages in the mailbox selected.
104
105       The client begins a message reading transaction with a READ
106       command.  The read command may optionally indicate which message
107       number to read, the default is the current message (incremented
108       when a message is read and set to one when a new folder is
109       selected).  The server returns the number of characters in the
110       message.
111
112
113
114
115 Butler, et. al.                                                 [Page 2]
116 \f
117
118
119 RFC 937                                                    February 1985
120 Post Office Protocol
121
122
123       The client asks for the content of the message to be sent with the
124       RETR command.  The server sends the message data.
125
126       When all the data has been received the client sends an
127       acknowledgment command.  This is one of ACKS, ACKD, and NACK.
128
129          ACKS means "I've received the message successfully and please
130          keep it in the mailbox".
131
132          ACKD means "I've received the message successfully and please
133          delete it from the mailbox".
134
135          NACK means "I did not receive the message and please keep it in
136          the mailbox".
137
138       In the case of ACKS or ACKD the server increments the current
139       message indicator.  In the case of NACK the current message
140       indicator stays the same.
141
142       In all cases the server returns the number of characters in the
143       (now) current message.
144
145       The client terminates the session with the QUIT command.  The
146       server returns an ok.
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173 Butler, et. al.                                                 [Page 3]
174 \f
175
176
177 RFC 937                                                    February 1985
178 Post Office Protocol
179
180
181    The Normal Scenario
182
183            Client                    Server
184            ------                    ------
185                                 Wait for Connection
186       Open Connection  -->
187                            <--  + POP2 Server Ready
188                                 Wait for Command
189       HELO Fred Secret -->
190                            <--  #13 messages for you
191                                 Wait for Command
192       READ 13          -->   
193                            <--  =537 characters in that message
194                                 Wait for Command
195       RETR             -->   
196                            <--  (send the message data)
197                                 Wait for Command
198       ACKS             -->   
199                            <--  =0 no more messages
200                                 Wait for Command
201       QUIT             -->
202                            <--  + OK
203       Close connection --> <--  Close connection
204                                 Wait for Connection (go back to start)
205
206 Conventions
207
208    Arguments
209
210       These arguments have system specific definitions.
211
212          user - A login account name.
213
214          password - The password for the login account.
215
216          mailbox - A mailbox name (also called a mail folder).
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231 Butler, et. al.                                                 [Page 4]
232 \f
233
234
235 RFC 937                                                    February 1985
236 Post Office Protocol
237
238
239    Default Mailboxes
240
241       TOPS-20
242
243          MAIL.TXT.1 - from login directory
244
245       UNIX
246
247          both
248             /usr/spool/mail/user
249          and
250             /usr/user/Mail/inbox/*
251
252             where "user" is the user value supplied in the HELO command.
253
254    End of Line
255
256       End of Line is Carriage Return (CR) followed by Line Feed (LF).
257       This sequence is indicated by "CRLF" in this document.  This end
258       of line convention must be used for commands and replies.
259
260    Message Length
261
262       The reply to the READ command or an acknowledgment command (ACKS,
263       ACKD, NACK) is the length (a character count) of the next message
264       to be transmitted.  This includes all the characters in the data
265       transmitted.  CRLF counts as two characters.  A length of zero
266       means the message does not exist or is empty.  A request to
267       transmit a message of zero length will result in the server
268       closing the connection.  The message is transmitted in the
269       standard internet format described in RFC-822 [2] and NVT-ASCII.
270       This may be different from the storage format and may make
271       computing the message length from the stored message non-trivial.
272
273    Message Numbers
274
275       The reply to the HELO and FOLD commands is a count of the number
276       of messages in a the selected mailbox.  The READ command has a
277       message number as an optional argument.  These numbers are
278       decimal, start at one, and computed with respect to the current
279       mailbox.  That is, the first message in a mailbox is message
280       number 1.
281
282    Numbers
283
284       All numbers in this memo and protocol are decimal.
285
286
287
288
289 Butler, et. al.                                                 [Page 5]
290 \f
291
292
293 RFC 937                                                    February 1985
294 Post Office Protocol
295
296
297    Quoting
298
299       In a few cases, there may be a need to have a special character in
300       an argument (user, password, or mailbox) that is not allowed by
301       the syntax.  For example, a space in a password. To allow for
302       this, a quoting convention is defined.  Unfortunately, such
303       quoting conventions "use up" another otherwise uninteresting
304       character.  In this protocol the back slash "\" is used as the
305       quote character.  To include a space in an argument the two
306       character sequence "back-slash, space" is transmitted.  To include
307       a back-slash in an argument the two character sequence
308       "back-slash, back-slash" is transmitted.  This quoting convention
309       is used in the command arguments only, it is not used in the mail
310       data transmitted in response to a RETR command.
311
312    Reply Strings
313
314       The first character is required to be as specified (i.e.,
315       "+", "-", "=", "#").  The optional strings that follow can be
316       whatever the implementer thinks is appropriate.
317
318 Definitions of Commands and Replies
319
320    Summary of Commands and Replies
321
322       Commands                          Replies
323       --------                          -------
324       HELO user password                + OK
325       FOLD mailbox                      - Error
326       READ [n]                          #xxx
327       RETR                              =yyy
328       ACKS
329       ACKD
330       NACK
331       QUIT
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347 Butler, et. al.                                                 [Page 6]
348 \f
349
350
351 RFC 937                                                    February 1985
352 Post Office Protocol
353
354
355    Commands
356
357       HELO user password
358
359          The Hello command identifies the user to the server and carries
360          the password authenticating this user.  This information is
361          used by the server to control access to the mailboxes.  The
362          Hello command is the "HELO" keyword, followed by the user
363          argument, followed by the password argument, followed by CRLF.
364
365             Possible responses:
366
367                "#nnn"
368
369                   where nnn is the number of messages in the default
370                   mailbox,"
371
372                "- error report" and Close the connection.
373
374       FOLD mailbox
375
376          The Folder command selects another mailbox or mail folder.  The
377          server must check that the user is permitted read access to
378          this mailbox.  If the mailbox is empty or does not exist, the
379          number of messages reported is zero.  The Folder command is the
380          "FOLD" keyword, followed by the mailbox argument, followed by
381          CRLF.
382
383             Possible responses:
384
385                "#nnn"
386
387                   where nnn is the number of messages in this mailbox.
388
389       READ [nnn]
390
391          The Read command begins a message reading transaction.  If the
392          Read command is given without an argument the current message
393          is  implied (the current message indicator is incremented  by
394          the ACKS or ACKD commands).  If an argument is used with the
395          Read command it is the message number to be read, and this
396          command sets the current message indicator to that value.  The
397          server returns the count of characters in the message to be
398          transmitted.  If there is no message to be read, the count of
399          zero is returned.  If the message was previously deleted with
400          the ACKD command, the count of zero is returned.  The Read
401          command is followed by the RETR command, the READ command, the
402          FOLD command, or the QUIT command.  Do not attempt to RETR a
403
404
405 Butler, et. al.                                                 [Page 7]
406 \f
407
408
409 RFC 937                                                    February 1985
410 Post Office Protocol
411
412
413          message of zero characters.  The Read command is the "READ"
414          keyword, optionally followed by the message number argument,
415          followed by CRLF.
416
417             Possible responses:
418
419                "=ccc"
420
421                   where ccc is the number of characters in this message.
422
423       RETR
424
425          The Retrieve command confirms that the client is ready to
426          receive the mail data.  It must be followed by an
427          acknowledgment command.  The server will close the connection
428          if asked to transmit a message of zero characters (i.e.,
429          transmit a non-existent message).  The message is transmitted
430          according to the Internet mail format standard RFC-822 [2] in
431          NVT-ASCII.  The Retrieve command is the "RETR" keyword,
432          followed by CRLF.
433
434             Possible responses:
435
436                the message data
437
438                Close the connection
439
440       ACKS
441
442          The Acknowledge and Save command confirms that the client has
443          received and accepted the message.  The ACKS command ends the
444          message reading transaction.  The message is kept in the
445          mailbox.  The current message indicator is incremented.  The
446          server returns the count of characters in the now current
447          message to be transmitted.  If there is no message to be read
448          or the message is marked deleted, the count of zero is
449          returned.  The Acknowledge and Save command is the "ACKS"
450          keyword, followed by CRLF.
451
452             Possible responses:
453
454                "=ccc"
455
456                   where ccc is the number of characters in the next
457                   message.
458
459
460
461
462
463 Butler, et. al.                                                 [Page 8]
464 \f
465
466
467 RFC 937                                                    February 1985
468 Post Office Protocol
469
470
471       ACKD
472
473          The Acknowledge and Delete command confirms that the client has
474          received and accepted the message.  The ACKD command ends the
475          message reading transaction.  If the user is authorized to have
476          write access to the mailbox, the message is deleted from the
477          mailbox.  Actually, the message is only marked for deletion.
478          The actual change is made  when the mailbox is released at the
479          end of the session or when the client selects another mailbox
480          with the FOLD command.  The messages are not renumbered until
481          the mailbox is released.  If the user does not have write
482          access to the mailbox no change is made to the mailbox.  The
483          response is the same whether or not the message was actually
484          deleted.  The current message indicator is incremented.  The
485          server returns the count of characters in the now current
486          message to be transmitted.  If there is no message to be read
487          or the message is marked deleted, the count of zero is
488          returned.  The Acknowledge and Delete command is the "ACKD"
489          keyword, followed by CRLF.
490
491             Possible responses:
492
493                "=ccc"
494
495                   where ccc is the number of characters in the next
496                   message.
497
498       NACK
499
500          The Negative Acknowledge command reports that the client did
501          not receive the message.  The NACK command ends the message
502          reading transaction.  The message is kept in the mailbox.  The
503          current message indicator remains the same.  The server returns
504          the count of characters in the current message.  Since the
505          count to be returned is for the message just transmitted it the
506          message must exist and not be marked deleted, and the count
507          must be positive (non-zero).  The Negative Acknowledge command
508          is the "NACK" keyword, followed by CRLF.
509
510             Possible responses:
511
512                "=ccc"
513
514                   where ccc is the number of characters in this message.
515
516
517
518
519
520
521 Butler, et. al.                                                 [Page 9]
522 \f
523
524
525 RFC 937                                                    February 1985
526 Post Office Protocol
527
528
529       QUIT
530
531          The Quit command indicates the client is done with the session.
532          The server sends an OK response and then closes the connection.
533          The Quit command is the "QUIT" keyword, followed by CRLF.
534
535             Possible responses:
536
537                "+ OK" and Close the connection
538
539    Replies
540
541       Greeting
542
543          The greeting is sent by the server as soon as the connection is
544          established.  The greeting is a plus sign, followed by the
545          protocol name ("POP2"), followed by the server host name,
546          optionally followed by text, and ending with a CRLF.
547
548       +
549
550          The success or plus sign response indicates successful
551          completion of the operation specified in the command.  The
552          success response is a plus sign, optionally followed by text,
553          and ending with a CRLF.
554
555       -
556
557          The failure or minus sign response indicates the failure of the
558          operation specified in the command.  The failure response is a
559          minus sign, optionally followed by text, and ending with a
560          CRLF.
561
562       =
563
564          The length or equal sign response tells the length in
565          characters of the message referenced by the command.  The
566          length response is a equal sign, followed by a number,
567          optionally followed by text, and ending with a CRLF.
568
569       #
570
571          The count or number sign response tells the number of messages
572          in a folder or mailbox referenced by the command.  The count
573          response is a number sign, followed by a number, optionally
574          followed by text, and ending with a CRLF.
575
576
577
578
579 Butler, et. al.                                                [Page 10]
580 \f
581
582
583 RFC 937                                                    February 1985
584 Post Office Protocol
585
586
587    Timeouts
588
589       In any protocol of this type there have to be timeouts.  Neither
590       side wants to get stuck waiting forever for the other side
591       (particularly is the other side has gone crazy or crashed).
592
593       The client expects a reply to a command fairly quickly and so
594       should have a short timeout for this.  This timeout is called T1.
595
596          For some servers, it may take some processing to compute the
597          number of messages in a mailbox, or the length of a message, or
598          to reformat a stored message for transmission, so this time out
599          has to allow for such processing time.  Also care must be taken
600          not to timeout waiting for the completion of a RETR reply while
601          a long message is in fact being transfered.
602
603       The server expects the session to progress with some but not
604       excessive delay between commands and so should have a long timeout
605       waiting for the next command.  This time out is T2.
606
607          One model of use of this protocol is that any number of
608          different types of clients can be built with different ways of
609          interacting with the human user and the server, but still
610          expecting the client to open the connection to the server,
611          present a sequence of commands, and close the connection,
612          without waiting for intervention by the human user.  With such
613          client implementations, it is reasonable for the server to have
614          a fairly small value for timeout T2.
615
616          On the other hand, one could easily have the client be very
617          human user directed with the user making decisions between
618          commands.  This would cause arbitrary delays between client
619          commands to the server, and require the value of timeout T2 to
620          be quite large.
621
622 Implementation Discussion
623
624    Comments on a Server on TOPS-20
625
626       On TOPS-20, a mailbox is a single file.  New messages are appended
627       to the file.  There is a separator line between messages.
628
629       The tricky part of implementing a POP2 server on TOPS-20 is to
630       provide for deleting messages.  This only has to be done for the
631       mailboxes (files) for which the user has write access.  The
632       problem is to avoid both (1) preventing other users from accessing
633       or updating the mailbox for long periods, and (2) accidentally
634       deleting a message the user has not seen.
635
636
637 Butler, et. al.                                                [Page 11]
638 \f
639
640
641 RFC 937                                                    February 1985
642 Post Office Protocol
643
644
645       One suggestion is as follows:
646
647          When a mailbox is first selected, if the user has write access,
648          rename the mailbox file to some temporary name.  Thus new
649          messages will be placed in a new instance of the mailbox file.
650          Conduct all POP2 operation on the temporary mailbox file
651          (including deleting messages).  When the POP2 session is over
652          or another mailbox is selected, prepend any messages left
653          undeleted in the temporary file to the new instance of the
654          mailbox file.
655
656    Sizes
657
658       The maximum length of a command line is 512 characters (including
659       the command word and the CRLF).
660
661       The maximum length of a reply line is 512 characters (including
662       the success indicator (+, -, =, #) and the CRLF).
663
664       The maximum length of a text line is 1000 characters (including
665       CRLF).
666
667    ISI has developed a POP2 server for TOPS-20 and for Berkeley 4.2
668    Unix, and a POP2 client for an IBM-PC and for Berkeley 4.2 Unix.
669
670 Extensions Not Supported
671
672    POP2 does not examine the internal data of messages.  In particular,
673    the server does not parse message headers.
674
675    The server doesn't have any state information (i.e., it doesn't know
676    from one session to the next what has happened).  For example, the
677    server doesn't know which messages were received since the last time
678    the user used POP2, so it can't send just the "new" messages.
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695 Butler, et. al.                                                [Page 12]
696 \f
697
698
699 RFC 937                                                    February 1985
700 Post Office Protocol
701
702
703 Examples
704
705    Example 1:
706
707            Client                    Server
708            ------                    ------
709                                 Wait for connection
710       Open connection  -->
711                            <--  + POP2 USC-ISIF.ARPA Server
712       HELO POSTEL SECRET -->
713                            <--  #2 messages in your mailbox
714       READ             -->   
715                            <--  =537 characters in message 1
716       RETR             -->   
717                            <--  [data of message 1]
718       ACKD             -->   
719                            <--  =234 characters in message 2
720       RETR             -->   
721                            <--  [data of message 2]
722       ACKD             -->   
723                            <--  =0 no more messages
724       QUIT             -->
725                            <--  + OK, bye, bye
726       Close connection --> <--  Close connection
727                                 Go back to start
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753 Butler, et. al.                                                [Page 13]
754 \f
755
756
757 RFC 937                                                    February 1985
758 Post Office Protocol
759
760
761    Example 2:
762
763            Client                    Server
764            ------                    ------
765                                 Wait for connection
766       Open connection  -->
767                            <--  + POP2 ISI-VAXA.ARPA server here
768       HELO smith secret -->
769                            <--  #35 messages
770       FOLD /usr/spool/mail/smith -->
771                            <--  #27 messages
772       READ  27         -->   
773                            <--  =10123 characters in that message
774       RETR             -->   
775                            <--  [data of message 27]
776       ACKS             -->   
777                            <--  =0 no more messages
778       QUIT             -->
779                            <--  + bye, call again sometime.
780       Close connection --> <--  Close connection
781                                 Go back to start
782
783    Example 3:
784
785            Client                    Server
786            ------                    ------
787                                 Wait for connection
788       Open connection  -->
789                            <--  + POP2 ISI-VAXA.ARPA server here
790       HELO Jones secret -->
791                            <--  #0 messages
792       READ             -->   
793                            <--  Close connection
794       Close connection -->
795                                 Go back to start
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811 Butler, et. al.                                                [Page 14]
812 \f
813
814
815 RFC 937                                                    February 1985
816 Post Office Protocol
817
818
819 Formal Syntax
820
821    <digit>    = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
822
823    <letter>   = A | B | C | ... | Z
824                 a | b | c | ... | z
825
826    <punct>    = ! | " | # | $ | % | & | ' | ( | ) | * |
827                 + | , | - | / | : | < | = | > | ? | @ |
828                 [ | ] | ^ | _ | ` | { | | | } | ~
829
830    <quote>    = \
831
832    <any>      = any one of the 128 ASCII codes
833
834    <CR>       = carriage return, code 10
835
836    <LF>       = line feed, code 13
837
838    <SP>       = space, code 32
839
840    <CRLF>     = <CR> <LF>
841
842    <print>    = <letter> | <digit> | <punct> | <quote> <any>
843
844    <char>     = <print> | <SP>
845
846    <word>     = <print> | <print> <word>
847
848    <string>   = <char> | <char> <string>
849
850    <ld>       = <letter> | <digit>
851
852    <ldh>      = <letter> | <digit> | -
853
854    <ldhs>     = <ldh> | <ldh> <ldhs>
855
856    <name>     = <letter> [ [ <ldhs> ] <ld> ]
857
858    <host>     =  <name> | <name> . <host>
859
860    <user>     = <word>
861
862    <password> = <word>
863
864    <mailbox>  = <string>
865
866    <number>   = <digit> | <digit> <number>
867
868
869 Butler, et. al.                                                [Page 15]
870 \f
871
872
873 RFC 937                                                    February 1985
874 Post Office Protocol
875
876
877    <helo>     = HELO <SP> <user> <SP> <password> <CRLF>
878
879    <fold>     = FOLD <SP> <mailbox> <CRLF>
880
881    <read>     = READ [<SP> <number>] <CRLF>
882
883    <retr>     = RETR <CRLF>
884
885    <acks>     = ACKS <CRLF>
886
887    <ackd>     = ACKD <CRLF>
888
889    <nack>     = NACK <CRLF>
890
891    <quit>     = QUIT <CRLF>
892
893    <ok>       = + [<SP> <string>] <CRLF>
894
895    <err>      = - [<SP> <string>] <CRLF>
896
897    <count>    = # <number> [<SP> <string>] <CRLF>
898
899    <greet>    = + <SP> POP2 <SP> <host> [<SP> <string>] <CRLF>
900
901    <length>   = = <number> [<SP> <string>] <CRLF>
902
903    <command>  = <helo> | <fold> | <read> | <retr> |
904                 <acks> | <ackd> | <nack> | <quit>
905
906    <reply>    = <ok> | <err> | <count> | <length> | <greet>
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927 Butler, et. al.                                                [Page 16]
928 \f
929
930
931 RFC 937                                                    February 1985
932 Post Office Protocol
933
934
935 Client State Diagram
936
937    
938                           |                    ^  + BYE  
939                           |  Open              |  -----  
940                           |           Greet    |  Close  
941                           V           -----    |         
942                       +-------+       QUIT    +-------+  
943                       | CALL  |-------------->| EXIT  |  
944                       +-------+               +-------+  
945                           |                       ^      
946                           |  Greet                |      
947                           |  -----                |      
948                           |  HELO                 |      
949               +---->+     |                       |      
950         #NNN  ^     |     |        #NNN           |      
951         ----  |     V     V        ----           |      
952         FOLD  |    +-------+       QUIT           |      
953               +<---| NMBR  |--------------------->+      
954                    +-------+                      ^      
955                     ^     |                       |      
956                     |     |  #NNN                 |      
957                     |     |  ----                 |      
958               =CCC  |     |  READ                 |      
959               ----  |     |                       |      
960               FOLD  |     |        =CCC           |      
961                     |     V        ----           |      
962         =CCC  +--->+-------+       QUIT           |      
963         ----  ^    | SIZE  |--------------------->+      
964         READ  +<---+-------+                             
965                     ^     |                              
966                     |     |  =CCC                        
967               data  |     |  ----                        
968               ----  |     |  RETR                        
969               ack   |     |                              
970                     |     V                              
971                    +-------+                             
972                    | XFER  |                             
973                    +-------+                             
974    
975
976
977
978
979
980
981
982
983
984
985 Butler, et. al.                                                [Page 17]
986 \f
987
988
989 RFC 937                                                    February 1985
990 Post Office Protocol
991
992
993 Server State Diagram
994
995    
996                        +<----------------------+  Close  
997                        |                       |  -----  
998                Listen  |                       |  Close  
999                        V                       |         
1000                    +-------+                  +-------+  
1001                    | LSTN  |                  | DONE  |  
1002                    +-------+                  +-------+  
1003                        |                          ^      
1004                        |  Open                    |      
1005                        |  -----                   |      
1006                        |  Greet                   |      
1007                        |                          |      
1008                        |           QUIT           |      
1009                        V           -----          |      
1010                    +-------+       + BYE          |      
1011                    | AUTH  |--------------------->+      
1012                    +-------+                      ^      
1013                        |                          |      
1014                        |  HELO                    |      
1015                        |  ----                    |      
1016                        |  #NNN                    |      
1017                        |                          |      
1018                        |           QUIT           |      
1019                        V           -----          |      
1020         FOLD  +--->+-------+       + BYE          |      
1021         ----  ^    | MBOX  |--------------------->+      
1022         #NNN  +<---+-------+                      ^      
1023                     ^     |                       |      
1024                     |     |  READ                 |      
1025               FOLD  |     |  ----                 |      
1026               ----  |     |  =CCC                 |      
1027               #NNN  |     |        QUIT           |      
1028                     |     V        -----          |      
1029         READ  +--->+-------+       + BYE          |      
1030         ----  ^    | ITEM  |--------------------->+      
1031         =CCC  +<---+-------+                             
1032                     ^     |                              
1033                     |     |  RETR                        
1034               ack   |     |  ----                        
1035               ----  |     |  data                        
1036               =CCC  |     |                              
1037                     |     V                              
1038                    +-------+                             
1039                    | NEXT  |                             
1040                    +-------+                             
1041
1042
1043 Butler, et. al.                                                [Page 18]
1044 \f
1045
1046
1047 RFC 937                                                    February 1985
1048 Post Office Protocol
1049
1050
1051 Combined Flow Diagram
1052
1053    
1054    +----+                                                              
1055    |CALL|<------------------------------------------------------------+
1056    |LSTN|                                                             ^
1057    +----+                                                             |
1058     | Greet                                                           |
1059     |                                                                 |
1060     |  +----------------------------------------------------->+       |
1061     |  ^ QUIT                                                 |       |
1062     V  |                                                      V       |
1063    +----+        +----+                                      +----+   |
1064    |CALL| HELO   |NMBR|                                      |EXIT|   |
1065    |AUTH|------->|AUTH|                                      |AUTH|   |
1066    +----+        +----+                                      +----+   |
1067                   | #NNN                                   + Bye |    |
1068                   |                                              |    |
1069                   |  +------------------------------------>+     |    |
1070                   |  ^ QUIT                                |     |    |
1071                   V  |                                     V     |    |
1072             +--->+----+        +----+                     +----+ |    |
1073        FOLD ^    |NMBR| READ   |SIZE|                     |EXIT| |    |
1074        ---- |    |MBOX|------->|MBOX|                     |MBOX| |    |
1075        #NNN +<---+----+        +----+                     +----+ |    |
1076                      ^           | =CCC                 + Bye |  |    |
1077                      |           |                            |  |    |
1078                 FOLD +<--------+ | +------------------->+     |  |    |
1079                 ----           ^ | ^ QUIT               |     |  |    |
1080                 #NNN           | V |                    V     |  |    |
1081                          +--->+-----+        +----+    +----+ |  |    |
1082                     READ ^    |SIZE | RETR   |XFER|    |EXIT| |  |    |
1083                     ---- |    | ITEM|------->|ITEM|    |ITEM| |  |    |
1084                     =CCC +<---+-----+        +----+    +----+ |  |    |
1085                                  ^             | data      |  |  |    |
1086                                  |             |           |  |  |    |
1087                             =CCC |             V     + Bye |  |  |    |
1088                                +----+        +----+        |  |  |    |
1089                                |SIZE|    Ack |XFER|        |  |  |    |
1090                                |NEXT|<-------|NEXT|        |  |  |    |
1091                                +----+        +----+        |  |  |    |
1092                                                            |  |  |    |
1093                                                            |  |  |    |
1094                                                            V  V  V    |
1095                                                           +-------+   |
1096                                                           | EXIT  |-->+
1097                                                           | DONE  |    
1098                                                           +-------+    
1099
1100
1101 Butler, et. al.                                                [Page 19]
1102 \f
1103
1104
1105 RFC 937                                                    February 1985
1106 Post Office Protocol
1107
1108
1109 Client Decision Table
1110
1111    
1112           |            STATE                 |
1113    -------+----------------------------------|
1114    INPUT  | CALL | NMBR | SIZE | XFER | EXIT |
1115    -------+----------------------------------|
1116    Greet  |  2   |  1   |  1   |  1   |  6   |
1117    -------+----------------------------------|
1118    #NNN   |  1   |  3   |  1   |  1   |  6   |
1119    -------+----------------------------------|
1120    =CCC   |  1   |  1   |  4   |  1   |  6   |
1121    -------+----------------------------------|
1122    data   |  1   |  1   |  1   |  5   |  6   |
1123    -------+----------------------------------|
1124    + Bye  |  1   |  1   |  1   |  1   |  6   |
1125    -------+----------------------------------|
1126    Close  |  1   |  1   |  1   |  1   |  6   |
1127    -------+----------------------------------|
1128    other  |  1   |  1   |  1   |  1   |  6   |
1129    -------+----------------------------------|
1130    Timeout|  1   |  1   |  1   |  1   |  6   |
1131    -------+----------------------------------|
1132    
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159 Butler, et. al.                                                [Page 20]
1160 \f
1161
1162
1163 RFC 937                                                    February 1985
1164 Post Office Protocol
1165
1166
1167    Actions:
1168
1169       1.  This is garbage.  Send "QUIT", and go to EXIT state.
1170
1171       2.  (a) If the greeting is right then send "HELO"
1172               and go to NMBR state,
1173           (b) Else send "QUIT" and go to EXIT state.
1174
1175       3.  (a) If user wants this folder and NNN > 0
1176               then send "READ" and go to SIZE state,
1177           (b) If user wants a this folder and NNN = 0
1178               then send "QUIT" and go to EXIT state,
1179           (c) If user wants a different folder
1180               then send "FOLD" and go to NMBR state.
1181
1182       4.  (a) If user wants this message and CCC > 0
1183               then send "RETR" and go to XFER state,
1184           (b) If user wants a this message and CCC = 0
1185               then send "QUIT" and go to EXIT state,
1186           (c) If user wants a different message
1187               then send "READ" and go to SIZE state.
1188
1189       5.  (a) If user wants this message kept
1190               then send "ACKS" and go to SIZE state,
1191           (b) If user wants a this message deleted
1192               then send "ACKD" and go to SIZE state,
1193           (c) If user wants a this message again
1194               then send "NACK" and go to SIZE state.
1195
1196       6.  Close the connection.
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217 Butler, et. al.                                                [Page 21]
1218 \f
1219
1220
1221 RFC 937                                                    February 1985
1222 Post Office Protocol
1223
1224
1225 Server Decision Table
1226
1227    
1228           |              STATE                       
1229    -------+----------------------------------------- 
1230    INPUT  | LSTN | AUTH | MBOX | ITEM | NEXT | DONE |
1231    -------+-----------------------------------------|
1232    Open   |  2   |  1   |  1   |  1   |  1   |  1   |
1233    -------+-----------------------------------------|
1234    HELO   |  1   |  3   |  1   |  1   |  1   |  1   |
1235    -------+-----------------------------------------|
1236    FOLD   |  1   |  1   |  5   |  5   |  1   |  1   |
1237    -------+-----------------------------------------|
1238    READ   |  1   |  1   |  6   |  6   |  1   |  1   |
1239    -------+-----------------------------------------|
1240    RETR   |  1   |  1   |  1   |  7   |  1   |  1   |
1241    -------+-----------------------------------------|
1242    ACKS   |  1   |  1   |  1   |  1   |  8   |  1   |
1243    -------+-----------------------------------------|
1244    ACKD   |  1   |  1   |  1   |  1   |  8   |  1   |
1245    -------+-----------------------------------------|
1246    NACK   |  1   |  1   |  1   |  1   |  8   |  1   |
1247    -------+-----------------------------------------|
1248    QUIT   |  1   |  4   |  4   |  4   |  1   |  1   |
1249    -------+-----------------------------------------|
1250    Close  |  1   |  1   |  1   |  1   |  1   |  9   |
1251    -------+-----------------------------------------|
1252    other  |  1   |  1   |  1   |  1   |  1   |  1   |
1253    -------+-----------------------------------------|
1254    Timeout|      |  1   |  1   |  1   |  1   |  1   |
1255    -------+-----------------------------------------|
1256    
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275 Butler, et. al.                                                [Page 22]
1276 \f
1277
1278
1279 RFC 937                                                    February 1985
1280 Post Office Protocol
1281
1282
1283    Actions:
1284
1285       1.  This is garbage.  Send "- error", and Close the connection.
1286
1287       2.  Send the greeting. Go to AUTH state.
1288
1289       3.  (a) If authorized user then send "#NNN" and go tp MBOX state,
1290           (b) Else send "- error" and Close the connection.
1291
1292       4.  Send "+ Bye" and go to DONE state.
1293
1294       5.  Send "+NNN" and go to MBOX state.
1295
1296       6.  Send "=CCC" and go to ITEM state.
1297
1298       7.  If message exists then send the data and got to NEXT state,
1299           Else Close the connection.
1300
1301       8.  Do what ACKS/ACKD/NACK require and go to ITEM state.
1302
1303       9.  Close the connection.
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333 Butler, et. al.                                                [Page 23]
1334 \f
1335
1336
1337 RFC 937                                                    February 1985
1338 Post Office Protocol
1339
1340
1341 Acknowledgment
1342
1343    We would like to acknowledge the helpful comments that we received on
1344    the first version of POP described in RFC 918, and the draft of POP2
1345    distributed to interested parties.
1346
1347 References
1348
1349    [1]  Postel, J., "Simple Mail Transfer Protocol", RFC 821,
1350    USC/Information Sciences Institute, August 1982.
1351
1352    [2]  Crocker, D., "Standard for the Format of ARPA-Internet Text
1353    Messages", RFC 822, University of Delaware, August 1982.
1354
1355    [3]  Reynolds, J.K., "Post Office Protocol", RFC 918, USC/Information
1356    Sciences Institute, October 1984.
1357
1358    [4]  Reynolds, J.K., and J. Postel, "Assigned Numbers", RFC 923,
1359    USC/Information Sciences Institute, October 1984.
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391 Butler, et. al.                                                [Page 24]
1392 \f