2007-09-25 [holger] 3.0.1cvs27
[claws.git] / doc / src / rfc1939.txt
1 \r
2 \r
3 \r
4 \r
5 \r
6 \r
7 Network Working Group                                           J. Myers\r
8 Request for Comments: 1939                               Carnegie Mellon\r
9 STD: 53                                                          M. Rose\r
10 Obsoletes: 1725                             Dover Beach Consulting, Inc.\r
11 Category: Standards Track                                       May 1996\r
12 \r
13 \r
14                     Post Office Protocol - Version 3\r
15 \r
16 Status of this Memo\r
17 \r
18    This document specifies an Internet standards track protocol for the\r
19    Internet community, and requests discussion and suggestions for\r
20    improvements.  Please refer to the current edition of the "Internet\r
21    Official Protocol Standards" (STD 1) for the standardization state\r
22    and status of this protocol.  Distribution of this memo is unlimited.\r
23 \r
24 Table of Contents\r
25 \r
26    1. Introduction ................................................    2\r
27    2. A Short Digression ..........................................    2\r
28    3. Basic Operation .............................................    3\r
29    4. The AUTHORIZATION State .....................................    4\r
30       QUIT Command ................................................    5\r
31    5. The TRANSACTION State .......................................    5\r
32       STAT Command ................................................    6\r
33       LIST Command ................................................    6\r
34       RETR Command ................................................    8\r
35       DELE Command ................................................    8\r
36       NOOP Command ................................................    9\r
37       RSET Command ................................................    9\r
38    6. The UPDATE State ............................................   10\r
39       QUIT Command ................................................   10\r
40    7. Optional POP3 Commands ......................................   11\r
41       TOP Command .................................................   11\r
42       UIDL Command ................................................   12\r
43       USER Command ................................................   13\r
44       PASS Command ................................................   14\r
45       APOP Command ................................................   15\r
46    8. Scaling and Operational Considerations ......................   16\r
47    9. POP3 Command Summary ........................................   18\r
48    10. Example POP3 Session .......................................   19\r
49    11. Message Format .............................................   19\r
50    12. References .................................................   20\r
51    13. Security Considerations ....................................   20\r
52    14. Acknowledgements ...........................................   20\r
53    15. Authors' Addresses .........................................   21\r
54    Appendix A. Differences from RFC 1725 ..........................   22\r
55 \r
56 \r
57 \r
58 Myers & Rose                Standards Track                     [Page 1]\r
59 \f\r
60 RFC 1939                          POP3                          May 1996\r
61 \r
62 \r
63    Appendix B. Command Index ......................................   23\r
64 \r
65 1. Introduction\r
66 \r
67    On certain types of smaller nodes in the Internet it is often\r
68    impractical to maintain a message transport system (MTS).  For\r
69    example, a workstation may not have sufficient resources (cycles,\r
70    disk space) in order to permit a SMTP server [RFC821] and associated\r
71    local mail delivery system to be kept resident and continuously\r
72    running.  Similarly, it may be expensive (or impossible) to keep a\r
73    personal computer interconnected to an IP-style network for long\r
74    amounts of time (the node is lacking the resource known as\r
75    "connectivity").\r
76 \r
77    Despite this, it is often very useful to be able to manage mail on\r
78    these smaller nodes, and they often support a user agent (UA) to aid\r
79    the tasks of mail handling.  To solve this problem, a node which can\r
80    support an MTS entity offers a maildrop service to these less endowed\r
81    nodes.  The Post Office Protocol - Version 3 (POP3) is intended to\r
82    permit a workstation to dynamically access a maildrop on a server\r
83    host in a useful fashion.  Usually, this means that the POP3 protocol\r
84    is used to allow a workstation to retrieve mail that the server is\r
85    holding for it.\r
86 \r
87    POP3 is not intended to provide extensive manipulation operations of\r
88    mail on the server; normally, mail is downloaded and then deleted.  A\r
89    more advanced (and complex) protocol, IMAP4, is discussed in\r
90    [RFC1730].\r
91 \r
92    For the remainder of this memo, the term "client host" refers to a\r
93    host making use of the POP3 service, while the term "server host"\r
94    refers to a host which offers the POP3 service.\r
95 \r
96 2. A Short Digression\r
97 \r
98    This memo does not specify how a client host enters mail into the\r
99    transport system, although a method consistent with the philosophy of\r
100    this memo is presented here:\r
101 \r
102       When the user agent on a client host wishes to enter a message\r
103       into the transport system, it establishes an SMTP connection to\r
104       its relay host and sends all mail to it.  This relay host could\r
105       be, but need not be, the POP3 server host for the client host.  Of\r
106       course, the relay host must accept mail for delivery to arbitrary\r
107       recipient addresses, that functionality is not required of all\r
108       SMTP servers.\r
109 \r
110 \r
111 \r
112 \r
113 \r
114 Myers & Rose                Standards Track                     [Page 2]\r
115 \f\r
116 RFC 1939                          POP3                          May 1996\r
117 \r
118 \r
119 3. Basic Operation\r
120 \r
121    Initially, the server host starts the POP3 service by listening on\r
122    TCP port 110.  When a client host wishes to make use of the service,\r
123    it establishes a TCP connection with the server host.  When the\r
124    connection is established, the POP3 server sends a greeting.  The\r
125    client and POP3 server then exchange commands and responses\r
126    (respectively) until the connection is closed or aborted.\r
127 \r
128    Commands in the POP3 consist of a case-insensitive keyword, possibly\r
129    followed by one or more arguments.  All commands are terminated by a\r
130    CRLF pair.  Keywords and arguments consist of printable ASCII\r
131    characters.  Keywords and arguments are each separated by a single\r
132    SPACE character.  Keywords are three or four characters long. Each\r
133    argument may be up to 40 characters long.\r
134 \r
135    Responses in the POP3 consist of a status indicator and a keyword\r
136    possibly followed by additional information.  All responses are\r
137    terminated by a CRLF pair.  Responses may be up to 512 characters\r
138    long, including the terminating CRLF.  There are currently two status\r
139    indicators: positive ("+OK") and negative ("-ERR").  Servers MUST\r
140    send the "+OK" and "-ERR" in upper case.\r
141 \r
142    Responses to certain commands are multi-line.  In these cases, which\r
143    are clearly indicated below, after sending the first line of the\r
144    response and a CRLF, any additional lines are sent, each terminated\r
145    by a CRLF pair.  When all lines of the response have been sent, a\r
146    final line is sent, consisting of a termination octet (decimal code\r
147    046, ".") and a CRLF pair.  If any line of the multi-line response\r
148    begins with the termination octet, the line is "byte-stuffed" by\r
149    pre-pending the termination octet to that line of the response.\r
150    Hence a multi-line response is terminated with the five octets\r
151    "CRLF.CRLF".  When examining a multi-line response, the client checks\r
152    to see if the line begins with the termination octet.  If so and if\r
153    octets other than CRLF follow, the first octet of the line (the\r
154    termination octet) is stripped away.  If so and if CRLF immediately\r
155    follows the termination character, then the response from the POP\r
156    server is ended and the line containing ".CRLF" is not considered\r
157    part of the multi-line response.\r
158 \r
159    A POP3 session progresses through a number of states during its\r
160    lifetime.  Once the TCP connection has been opened and the POP3\r
161    server has sent the greeting, the session enters the AUTHORIZATION\r
162    state.  In this state, the client must identify itself to the POP3\r
163    server.  Once the client has successfully done this, the server\r
164    acquires resources associated with the client's maildrop, and the\r
165    session enters the TRANSACTION state.  In this state, the client\r
166    requests actions on the part of the POP3 server.  When the client has\r
167 \r
168 \r
169 \r
170 Myers & Rose                Standards Track                     [Page 3]\r
171 \f\r
172 RFC 1939                          POP3                          May 1996\r
173 \r
174 \r
175    issued the QUIT command, the session enters the UPDATE state.  In\r
176    this state, the POP3 server releases any resources acquired during\r
177    the TRANSACTION state and says goodbye.  The TCP connection is then\r
178    closed.\r
179 \r
180    A server MUST respond to an unrecognized, unimplemented, or\r
181    syntactically invalid command by responding with a negative status\r
182    indicator.  A server MUST respond to a command issued when the\r
183    session is in an incorrect state by responding with a negative status\r
184    indicator.  There is no general method for a client to distinguish\r
185    between a server which does not implement an optional command and a\r
186    server which is unwilling or unable to process the command.\r
187 \r
188    A POP3 server MAY have an inactivity autologout timer.  Such a timer\r
189    MUST be of at least 10 minutes' duration.  The receipt of any command\r
190    from the client during that interval should suffice to reset the\r
191    autologout timer.  When the timer expires, the session does NOT enter\r
192    the UPDATE state--the server should close the TCP connection without\r
193    removing any messages or sending any response to the client.\r
194 \r
195 4. The AUTHORIZATION State\r
196 \r
197    Once the TCP connection has been opened by a POP3 client, the POP3\r
198    server issues a one line greeting.  This can be any positive\r
199    response.  An example might be:\r
200 \r
201       S:  +OK POP3 server ready\r
202 \r
203    The POP3 session is now in the AUTHORIZATION state.  The client must\r
204    now identify and authenticate itself to the POP3 server.  Two\r
205    possible mechanisms for doing this are described in this document,\r
206    the USER and PASS command combination and the APOP command.  Both\r
207    mechanisms are described later in this document.  Additional\r
208    authentication mechanisms are described in [RFC1734].  While there is\r
209    no single authentication mechanism that is required of all POP3\r
210    servers, a POP3 server must of course support at least one\r
211    authentication mechanism.\r
212 \r
213    Once the POP3 server has determined through the use of any\r
214    authentication command that the client should be given access to the\r
215    appropriate maildrop, the POP3 server then acquires an exclusive-\r
216    access lock on the maildrop, as necessary to prevent messages from\r
217    being modified or removed before the session enters the UPDATE state.\r
218    If the lock is successfully acquired, the POP3 server responds with a\r
219    positive status indicator.  The POP3 session now enters the\r
220    TRANSACTION state, with no messages marked as deleted.  If the\r
221    maildrop cannot be opened for some reason (for example, a lock can\r
222    not be acquired, the client is denied access to the appropriate\r
223 \r
224 \r
225 \r
226 Myers & Rose                Standards Track                     [Page 4]\r
227 \f\r
228 RFC 1939                          POP3                          May 1996\r
229 \r
230 \r
231    maildrop, or the maildrop cannot be parsed), the POP3 server responds\r
232    with a negative status indicator.  (If a lock was acquired but the\r
233    POP3 server intends to respond with a negative status indicator, the\r
234    POP3 server must release the lock prior to rejecting the command.)\r
235    After returning a negative status indicator, the server may close the\r
236    connection.  If the server does not close the connection, the client\r
237    may either issue a new authentication command and start again, or the\r
238    client may issue the QUIT command.\r
239 \r
240    After the POP3 server has opened the maildrop, it assigns a message-\r
241    number to each message, and notes the size of each message in octets.\r
242    The first message in the maildrop is assigned a message-number of\r
243    "1", the second is assigned "2", and so on, so that the nth message\r
244    in a maildrop is assigned a message-number of "n".  In POP3 commands\r
245    and responses, all message-numbers and message sizes are expressed in\r
246    base-10 (i.e., decimal).\r
247 \r
248    Here is the summary for the QUIT command when used in the\r
249    AUTHORIZATION state:\r
250 \r
251       QUIT\r
252 \r
253          Arguments: none\r
254 \r
255          Restrictions: none\r
256 \r
257          Possible Responses:\r
258              +OK\r
259 \r
260          Examples:\r
261              C: QUIT\r
262              S: +OK dewey POP3 server signing off\r
263 \r
264 5. The TRANSACTION State\r
265 \r
266    Once the client has successfully identified itself to the POP3 server\r
267    and the POP3 server has locked and opened the appropriate maildrop,\r
268    the POP3 session is now in the TRANSACTION state.  The client may now\r
269    issue any of the following POP3 commands repeatedly.  After each\r
270    command, the POP3 server issues a response.  Eventually, the client\r
271    issues the QUIT command and the POP3 session enters the UPDATE state.\r
272 \r
273 \r
274 \r
275 \r
276 \r
277 \r
278 \r
279 \r
280 \r
281 \r
282 Myers & Rose                Standards Track                     [Page 5]\r
283 \f\r
284 RFC 1939                          POP3                          May 1996\r
285 \r
286 \r
287    Here are the POP3 commands valid in the TRANSACTION state:\r
288 \r
289       STAT\r
290 \r
291          Arguments: none\r
292 \r
293          Restrictions:\r
294              may only be given in the TRANSACTION state\r
295 \r
296          Discussion:\r
297              The POP3 server issues a positive response with a line\r
298              containing information for the maildrop.  This line is\r
299              called a "drop listing" for that maildrop.\r
300 \r
301              In order to simplify parsing, all POP3 servers are\r
302              required to use a certain format for drop listings.  The\r
303              positive response consists of "+OK" followed by a single\r
304              space, the number of messages in the maildrop, a single\r
305              space, and the size of the maildrop in octets.  This memo\r
306              makes no requirement on what follows the maildrop size.\r
307              Minimal implementations should just end that line of the\r
308              response with a CRLF pair.  More advanced implementations\r
309              may include other information.\r
310 \r
311                 NOTE: This memo STRONGLY discourages implementations\r
312                 from supplying additional information in the drop\r
313                 listing.  Other, optional, facilities are discussed\r
314                 later on which permit the client to parse the messages\r
315                 in the maildrop.\r
316 \r
317              Note that messages marked as deleted are not counted in\r
318              either total.\r
319 \r
320          Possible Responses:\r
321              +OK nn mm\r
322 \r
323          Examples:\r
324              C: STAT\r
325              S: +OK 2 320\r
326 \r
327 \r
328       LIST [msg]\r
329 \r
330          Arguments:\r
331              a message-number (optional), which, if present, may NOT\r
332              refer to a message marked as deleted\r
333 \r
334 \r
335 \r
336 \r
337 \r
338 Myers & Rose                Standards Track                     [Page 6]\r
339 \f\r
340 RFC 1939                          POP3                          May 1996\r
341 \r
342 \r
343          Restrictions:\r
344              may only be given in the TRANSACTION state\r
345 \r
346          Discussion:\r
347              If an argument was given and the POP3 server issues a\r
348              positive response with a line containing information for\r
349              that message.  This line is called a "scan listing" for\r
350              that message.\r
351 \r
352              If no argument was given and the POP3 server issues a\r
353              positive response, then the response given is multi-line.\r
354              After the initial +OK, for each message in the maildrop,\r
355              the POP3 server responds with a line containing\r
356              information for that message.  This line is also called a\r
357              "scan listing" for that message.  If there are no\r
358              messages in the maildrop, then the POP3 server responds\r
359              with no scan listings--it issues a positive response\r
360              followed by a line containing a termination octet and a\r
361              CRLF pair.\r
362 \r
363              In order to simplify parsing, all POP3 servers are\r
364              required to use a certain format for scan listings.  A\r
365              scan listing consists of the message-number of the\r
366              message, followed by a single space and the exact size of\r
367              the message in octets.  Methods for calculating the exact\r
368              size of the message are described in the "Message Format"\r
369              section below.  This memo makes no requirement on what\r
370              follows the message size in the scan listing.  Minimal\r
371              implementations should just end that line of the response\r
372              with a CRLF pair.  More advanced implementations may\r
373              include other information, as parsed from the message.\r
374 \r
375                 NOTE: This memo STRONGLY discourages implementations\r
376                 from supplying additional information in the scan\r
377                 listing.  Other, optional, facilities are discussed\r
378                 later on which permit the client to parse the messages\r
379                 in the maildrop.\r
380 \r
381              Note that messages marked as deleted are not listed.\r
382 \r
383          Possible Responses:\r
384              +OK scan listing follows\r
385              -ERR no such message\r
386 \r
387          Examples:\r
388              C: LIST\r
389              S: +OK 2 messages (320 octets)\r
390              S: 1 120\r
391 \r
392 \r
393 \r
394 Myers & Rose                Standards Track                     [Page 7]\r
395 \f\r
396 RFC 1939                          POP3                          May 1996\r
397 \r
398 \r
399              S: 2 200\r
400              S: .\r
401                ...\r
402              C: LIST 2\r
403              S: +OK 2 200\r
404                ...\r
405              C: LIST 3\r
406              S: -ERR no such message, only 2 messages in maildrop\r
407 \r
408 \r
409       RETR msg\r
410 \r
411          Arguments:\r
412              a message-number (required) which may NOT refer to a\r
413              message marked as deleted\r
414 \r
415          Restrictions:\r
416              may only be given in the TRANSACTION state\r
417 \r
418          Discussion:\r
419              If the POP3 server issues a positive response, then the\r
420              response given is multi-line.  After the initial +OK, the\r
421              POP3 server sends the message corresponding to the given\r
422              message-number, being careful to byte-stuff the termination\r
423              character (as with all multi-line responses).\r
424 \r
425          Possible Responses:\r
426              +OK message follows\r
427              -ERR no such message\r
428 \r
429          Examples:\r
430              C: RETR 1\r
431              S: +OK 120 octets\r
432              S: <the POP3 server sends the entire message here>\r
433              S: .\r
434 \r
435 \r
436       DELE msg\r
437 \r
438          Arguments:\r
439              a message-number (required) which may NOT refer to a\r
440              message marked as deleted\r
441 \r
442          Restrictions:\r
443              may only be given in the TRANSACTION state\r
444 \r
445 \r
446 \r
447 \r
448 \r
449 \r
450 Myers & Rose                Standards Track                     [Page 8]\r
451 \f\r
452 RFC 1939                          POP3                          May 1996\r
453 \r
454 \r
455          Discussion:\r
456              The POP3 server marks the message as deleted.  Any future\r
457              reference to the message-number associated with the message\r
458              in a POP3 command generates an error.  The POP3 server does\r
459              not actually delete the message until the POP3 session\r
460              enters the UPDATE state.\r
461 \r
462          Possible Responses:\r
463              +OK message deleted\r
464              -ERR no such message\r
465 \r
466          Examples:\r
467              C: DELE 1\r
468              S: +OK message 1 deleted\r
469                 ...\r
470              C: DELE 2\r
471              S: -ERR message 2 already deleted\r
472 \r
473 \r
474       NOOP\r
475 \r
476          Arguments: none\r
477 \r
478          Restrictions:\r
479              may only be given in the TRANSACTION state\r
480 \r
481          Discussion:\r
482              The POP3 server does nothing, it merely replies with a\r
483              positive response.\r
484 \r
485          Possible Responses:\r
486              +OK\r
487 \r
488          Examples:\r
489              C: NOOP\r
490              S: +OK\r
491 \r
492 \r
493       RSET\r
494 \r
495          Arguments: none\r
496 \r
497          Restrictions:\r
498              may only be given in the TRANSACTION state\r
499 \r
500          Discussion:\r
501              If any messages have been marked as deleted by the POP3\r
502              server, they are unmarked.  The POP3 server then replies\r
503 \r
504 \r
505 \r
506 Myers & Rose                Standards Track                     [Page 9]\r
507 \f\r
508 RFC 1939                          POP3                          May 1996\r
509 \r
510 \r
511              with a positive response.\r
512 \r
513          Possible Responses:\r
514              +OK\r
515 \r
516          Examples:\r
517              C: RSET\r
518              S: +OK maildrop has 2 messages (320 octets)\r
519 \r
520 6. The UPDATE State\r
521 \r
522    When the client issues the QUIT command from the TRANSACTION state,\r
523    the POP3 session enters the UPDATE state.  (Note that if the client\r
524    issues the QUIT command from the AUTHORIZATION state, the POP3\r
525    session terminates but does NOT enter the UPDATE state.)\r
526 \r
527    If a session terminates for some reason other than a client-issued\r
528    QUIT command, the POP3 session does NOT enter the UPDATE state and\r
529    MUST not remove any messages from the maildrop.\r
530 \r
531       QUIT\r
532 \r
533          Arguments: none\r
534 \r
535          Restrictions: none\r
536 \r
537          Discussion:\r
538              The POP3 server removes all messages marked as deleted\r
539              from the maildrop and replies as to the status of this\r
540              operation.  If there is an error, such as a resource\r
541              shortage, encountered while removing messages, the\r
542              maildrop may result in having some or none of the messages\r
543              marked as deleted be removed.  In no case may the server\r
544              remove any messages not marked as deleted.\r
545 \r
546              Whether the removal was successful or not, the server\r
547              then releases any exclusive-access lock on the maildrop\r
548              and closes the TCP connection.\r
549 \r
550          Possible Responses:\r
551              +OK\r
552              -ERR some deleted messages not removed\r
553 \r
554          Examples:\r
555              C: QUIT\r
556              S: +OK dewey POP3 server signing off (maildrop empty)\r
557                 ...\r
558              C: QUIT\r
559 \r
560 \r
561 \r
562 Myers & Rose                Standards Track                    [Page 10]\r
563 \f\r
564 RFC 1939                          POP3                          May 1996\r
565 \r
566 \r
567              S: +OK dewey POP3 server signing off (2 messages left)\r
568                 ...\r
569 \r
570 7. Optional POP3 Commands\r
571 \r
572    The POP3 commands discussed above must be supported by all minimal\r
573    implementations of POP3 servers.\r
574 \r
575    The optional POP3 commands described below permit a POP3 client\r
576    greater freedom in message handling, while preserving a simple POP3\r
577    server implementation.\r
578 \r
579       NOTE: This memo STRONGLY encourages implementations to support\r
580       these commands in lieu of developing augmented drop and scan\r
581       listings.  In short, the philosophy of this memo is to put\r
582       intelligence in the part of the POP3 client and not the POP3\r
583       server.\r
584 \r
585       TOP msg n\r
586 \r
587          Arguments:\r
588              a message-number (required) which may NOT refer to to a\r
589              message marked as deleted, and a non-negative number\r
590              of lines (required)\r
591 \r
592          Restrictions:\r
593              may only be given in the TRANSACTION state\r
594 \r
595          Discussion:\r
596              If the POP3 server issues a positive response, then the\r
597              response given is multi-line.  After the initial +OK, the\r
598              POP3 server sends the headers of the message, the blank\r
599              line separating the headers from the body, and then the\r
600              number of lines of the indicated message's body, being\r
601              careful to byte-stuff the termination character (as with\r
602              all multi-line responses).\r
603 \r
604              Note that if the number of lines requested by the POP3\r
605              client is greater than than the number of lines in the\r
606              body, then the POP3 server sends the entire message.\r
607 \r
608          Possible Responses:\r
609              +OK top of message follows\r
610              -ERR no such message\r
611 \r
612          Examples:\r
613              C: TOP 1 10\r
614              S: +OK\r
615 \r
616 \r
617 \r
618 Myers & Rose                Standards Track                    [Page 11]\r
619 \f\r
620 RFC 1939                          POP3                          May 1996\r
621 \r
622 \r
623              S: <the POP3 server sends the headers of the\r
624                 message, a blank line, and the first 10 lines\r
625                 of the body of the message>\r
626              S: .\r
627                 ...\r
628              C: TOP 100 3\r
629              S: -ERR no such message\r
630 \r
631 \r
632       UIDL [msg]\r
633 \r
634       Arguments:\r
635           a message-number (optional), which, if present, may NOT\r
636           refer to a message marked as deleted\r
637 \r
638       Restrictions:\r
639           may only be given in the TRANSACTION state.\r
640 \r
641       Discussion:\r
642           If an argument was given and the POP3 server issues a positive\r
643           response with a line containing information for that message.\r
644           This line is called a "unique-id listing" for that message.\r
645 \r
646           If no argument was given and the POP3 server issues a positive\r
647           response, then the response given is multi-line.  After the\r
648           initial +OK, for each message in the maildrop, the POP3 server\r
649           responds with a line containing information for that message.\r
650           This line is called a "unique-id listing" for that message.\r
651 \r
652           In order to simplify parsing, all POP3 servers are required to\r
653           use a certain format for unique-id listings.  A unique-id\r
654           listing consists of the message-number of the message,\r
655           followed by a single space and the unique-id of the message.\r
656           No information follows the unique-id in the unique-id listing.\r
657 \r
658           The unique-id of a message is an arbitrary server-determined\r
659           string, consisting of one to 70 characters in the range 0x21\r
660           to 0x7E, which uniquely identifies a message within a\r
661           maildrop and which persists across sessions.  This\r
662           persistence is required even if a session ends without\r
663           entering the UPDATE state.  The server should never reuse an\r
664           unique-id in a given maildrop, for as long as the entity\r
665           using the unique-id exists.\r
666 \r
667           Note that messages marked as deleted are not listed.\r
668 \r
669           While it is generally preferable for server implementations\r
670           to store arbitrarily assigned unique-ids in the maildrop,\r
671 \r
672 \r
673 \r
674 Myers & Rose                Standards Track                    [Page 12]\r
675 \f\r
676 RFC 1939                          POP3                          May 1996\r
677 \r
678 \r
679           this specification is intended to permit unique-ids to be\r
680           calculated as a hash of the message.  Clients should be able\r
681           to handle a situation where two identical copies of a\r
682           message in a maildrop have the same unique-id.\r
683 \r
684       Possible Responses:\r
685           +OK unique-id listing follows\r
686           -ERR no such message\r
687 \r
688       Examples:\r
689           C: UIDL\r
690           S: +OK\r
691           S: 1 whqtswO00WBw418f9t5JxYwZ\r
692           S: 2 QhdPYR:00WBw1Ph7x7\r
693           S: .\r
694              ...\r
695           C: UIDL 2\r
696           S: +OK 2 QhdPYR:00WBw1Ph7x7\r
697              ...\r
698           C: UIDL 3\r
699           S: -ERR no such message, only 2 messages in maildrop\r
700 \r
701 \r
702       USER name\r
703 \r
704          Arguments:\r
705              a string identifying a mailbox (required), which is of\r
706              significance ONLY to the server\r
707 \r
708          Restrictions:\r
709              may only be given in the AUTHORIZATION state after the POP3\r
710              greeting or after an unsuccessful USER or PASS command\r
711 \r
712          Discussion:\r
713              To authenticate using the USER and PASS command\r
714              combination, the client must first issue the USER\r
715              command.  If the POP3 server responds with a positive\r
716              status indicator ("+OK"), then the client may issue\r
717              either the PASS command to complete the authentication,\r
718              or the QUIT command to terminate the POP3 session.  If\r
719              the POP3 server responds with a negative status indicator\r
720              ("-ERR") to the USER command, then the client may either\r
721              issue a new authentication command or may issue the QUIT\r
722              command.\r
723 \r
724              The server may return a positive response even though no\r
725              such mailbox exists.  The server may return a negative\r
726              response if mailbox exists, but does not permit plaintext\r
727 \r
728 \r
729 \r
730 Myers & Rose                Standards Track                    [Page 13]\r
731 \f\r
732 RFC 1939                          POP3                          May 1996\r
733 \r
734 \r
735              password authentication.\r
736 \r
737          Possible Responses:\r
738              +OK name is a valid mailbox\r
739              -ERR never heard of mailbox name\r
740 \r
741          Examples:\r
742              C: USER frated\r
743              S: -ERR sorry, no mailbox for frated here\r
744                 ...\r
745              C: USER mrose\r
746              S: +OK mrose is a real hoopy frood\r
747 \r
748 \r
749       PASS string\r
750 \r
751          Arguments:\r
752              a server/mailbox-specific password (required)\r
753 \r
754          Restrictions:\r
755              may only be given in the AUTHORIZATION state immediately\r
756              after a successful USER command\r
757 \r
758          Discussion:\r
759              When the client issues the PASS command, the POP3 server\r
760              uses the argument pair from the USER and PASS commands to\r
761              determine if the client should be given access to the\r
762              appropriate maildrop.\r
763 \r
764              Since the PASS command has exactly one argument, a POP3\r
765              server may treat spaces in the argument as part of the\r
766              password, instead of as argument separators.\r
767 \r
768          Possible Responses:\r
769              +OK maildrop locked and ready\r
770              -ERR invalid password\r
771              -ERR unable to lock maildrop\r
772 \r
773          Examples:\r
774              C: USER mrose\r
775              S: +OK mrose is a real hoopy frood\r
776              C: PASS secret\r
777              S: -ERR maildrop already locked\r
778                ...\r
779              C: USER mrose\r
780              S: +OK mrose is a real hoopy frood\r
781              C: PASS secret\r
782              S: +OK mrose's maildrop has 2 messages (320 octets)\r
783 \r
784 \r
785 \r
786 Myers & Rose                Standards Track                    [Page 14]\r
787 \f\r
788 RFC 1939                          POP3                          May 1996\r
789 \r
790 \r
791       APOP name digest\r
792 \r
793          Arguments:\r
794              a string identifying a mailbox and a MD5 digest string\r
795              (both required)\r
796 \r
797          Restrictions:\r
798              may only be given in the AUTHORIZATION state after the POP3\r
799              greeting or after an unsuccessful USER or PASS command\r
800 \r
801          Discussion:\r
802              Normally, each POP3 session starts with a USER/PASS\r
803              exchange.  This results in a server/user-id specific\r
804              password being sent in the clear on the network.  For\r
805              intermittent use of POP3, this may not introduce a sizable\r
806              risk.  However, many POP3 client implementations connect to\r
807              the POP3 server on a regular basis -- to check for new\r
808              mail.  Further the interval of session initiation may be on\r
809              the order of five minutes.  Hence, the risk of password\r
810              capture is greatly enhanced.\r
811 \r
812              An alternate method of authentication is required which\r
813              provides for both origin authentication and replay\r
814              protection, but which does not involve sending a password\r
815              in the clear over the network.  The APOP command provides\r
816              this functionality.\r
817 \r
818              A POP3 server which implements the APOP command will\r
819              include a timestamp in its banner greeting.  The syntax of\r
820              the timestamp corresponds to the `msg-id' in [RFC822], and\r
821              MUST be different each time the POP3 server issues a banner\r
822              greeting.  For example, on a UNIX implementation in which a\r
823              separate UNIX process is used for each instance of a POP3\r
824              server, the syntax of the timestamp might be:\r
825 \r
826                 <process-ID.clock@hostname>\r
827 \r
828              where `process-ID' is the decimal value of the process's\r
829              PID, clock is the decimal value of the system clock, and\r
830              hostname is the fully-qualified domain-name corresponding\r
831              to the host where the POP3 server is running.\r
832 \r
833              The POP3 client makes note of this timestamp, and then\r
834              issues the APOP command.  The `name' parameter has\r
835              identical semantics to the `name' parameter of the USER\r
836              command. The `digest' parameter is calculated by applying\r
837              the MD5 algorithm [RFC1321] to a string consisting of the\r
838              timestamp (including angle-brackets) followed by a shared\r
839 \r
840 \r
841 \r
842 Myers & Rose                Standards Track                    [Page 15]\r
843 \f\r
844 RFC 1939                          POP3                          May 1996\r
845 \r
846 \r
847              secret.  This shared secret is a string known only to the\r
848              POP3 client and server.  Great care should be taken to\r
849              prevent unauthorized disclosure of the secret, as knowledge\r
850              of the secret will allow any entity to successfully\r
851              masquerade as the named user.  The `digest' parameter\r
852              itself is a 16-octet value which is sent in hexadecimal\r
853              format, using lower-case ASCII characters.\r
854 \r
855              When the POP3 server receives the APOP command, it verifies\r
856              the digest provided.  If the digest is correct, the POP3\r
857              server issues a positive response, and the POP3 session\r
858              enters the TRANSACTION state.  Otherwise, a negative\r
859              response is issued and the POP3 session remains in the\r
860              AUTHORIZATION state.\r
861 \r
862              Note that as the length of the shared secret increases, so\r
863              does the difficulty of deriving it.  As such, shared\r
864              secrets should be long strings (considerably longer than\r
865              the 8-character example shown below).\r
866 \r
867          Possible Responses:\r
868              +OK maildrop locked and ready\r
869              -ERR permission denied\r
870 \r
871          Examples:\r
872              S: +OK POP3 server ready <1896.697170952@dbc.mtview.ca.us>\r
873              C: APOP mrose c4c9334bac560ecc979e58001b3e22fb\r
874              S: +OK maildrop has 1 message (369 octets)\r
875 \r
876              In this example, the shared  secret  is  the  string  `tan-\r
877              staaf'.  Hence, the MD5 algorithm is applied to the string\r
878 \r
879                 <1896.697170952@dbc.mtview.ca.us>tanstaaf\r
880 \r
881              which produces a digest value of\r
882 \r
883                 c4c9334bac560ecc979e58001b3e22fb\r
884 \r
885 8. Scaling and Operational Considerations\r
886 \r
887    Since some of the optional features described above were added to the\r
888    POP3 protocol, experience has accumulated in using them in large-\r
889    scale commercial post office operations where most of the users are\r
890    unrelated to each other.  In these situations and others, users and\r
891    vendors of POP3 clients have discovered that the combination of using\r
892    the UIDL command and not issuing the DELE command can provide a weak\r
893    version of the "maildrop as semi-permanent repository" functionality\r
894    normally associated with IMAP.  Of course the other capabilities of\r
895 \r
896 \r
897 \r
898 Myers & Rose                Standards Track                    [Page 16]\r
899 \f\r
900 RFC 1939                          POP3                          May 1996\r
901 \r
902 \r
903    IMAP, such as polling an existing connection for newly arrived\r
904    messages and supporting multiple folders on the server, are not\r
905    present in POP3.\r
906 \r
907    When these facilities are used in this way by casual users, there has\r
908    been a tendency for already-read messages to accumulate on the server\r
909    without bound.  This is clearly an undesirable behavior pattern from\r
910    the standpoint of the server operator.  This situation is aggravated\r
911    by the fact that the limited capabilities of the POP3 do not permit\r
912    efficient handling of maildrops which have hundreds or thousands of\r
913    messages.\r
914 \r
915    Consequently, it is recommended that operators of large-scale multi-\r
916    user servers, especially ones in which the user's only access to the\r
917    maildrop is via POP3, consider such options as:\r
918 \r
919    *  Imposing a per-user maildrop storage quota or the like.\r
920 \r
921       A disadvantage to this option is that accumulation of messages may\r
922       result in the user's inability to receive new ones into the\r
923       maildrop.  Sites which choose this option should be sure to inform\r
924       users of impending or current exhaustion of quota, perhaps by\r
925       inserting an appropriate message into the user's maildrop.\r
926 \r
927    *  Enforce a site policy regarding mail retention on the server.\r
928 \r
929       Sites are free to establish local policy regarding the storage and\r
930       retention of messages on the server, both read and unread.  For\r
931       example, a site might delete unread messages from the server after\r
932       60 days and delete read messages after 7 days.  Such message\r
933       deletions are outside the scope of the POP3 protocol and are not\r
934       considered a protocol violation.\r
935 \r
936       Server operators enforcing message deletion policies should take\r
937       care to make all users aware of the policies in force.\r
938 \r
939       Clients must not assume that a site policy will automate message\r
940       deletions, and should continue to explicitly delete messages using\r
941       the DELE command when appropriate.\r
942 \r
943       It should be noted that enforcing site message deletion policies\r
944       may be confusing to the user community, since their POP3 client\r
945       may contain configuration options to leave mail on the server\r
946       which will not in fact be supported by the server.\r
947 \r
948       One special case of a site policy is that messages may only be\r
949       downloaded once from the server, and are deleted after this has\r
950       been accomplished.  This could be implemented in POP3 server\r
951 \r
952 \r
953 \r
954 Myers & Rose                Standards Track                    [Page 17]\r
955 \f\r
956 RFC 1939                          POP3                          May 1996\r
957 \r
958 \r
959       software by the following mechanism: "following a POP3 login by a\r
960       client which was ended by a QUIT, delete all messages downloaded\r
961       during the session with the RETR command".  It is important not to\r
962       delete messages in the event of abnormal connection termination\r
963       (ie, if no QUIT was received from the client) because the client\r
964       may not have successfully received or stored the messages.\r
965       Servers implementing a download-and-delete policy may also wish to\r
966       disable or limit the optional TOP command, since it could be used\r
967       as an alternate mechanism to download entire messages.\r
968 \r
969 9. POP3 Command Summary\r
970 \r
971       Minimal POP3 Commands:\r
972 \r
973          USER name               valid in the AUTHORIZATION state\r
974          PASS string\r
975          QUIT\r
976 \r
977          STAT                    valid in the TRANSACTION state\r
978          LIST [msg]\r
979          RETR msg\r
980          DELE msg\r
981          NOOP\r
982          RSET\r
983          QUIT\r
984 \r
985       Optional POP3 Commands:\r
986 \r
987          APOP name digest        valid in the AUTHORIZATION state\r
988 \r
989          TOP msg n               valid in the TRANSACTION state\r
990          UIDL [msg]\r
991 \r
992       POP3 Replies:\r
993 \r
994          +OK\r
995          -ERR\r
996 \r
997       Note that with the exception of the STAT, LIST, and UIDL commands,\r
998       the reply given by the POP3 server to any command is significant\r
999       only to "+OK" and "-ERR".  Any text occurring after this reply\r
1000       may be ignored by the client.\r
1001 \r
1002 \r
1003 \r
1004 \r
1005 \r
1006 \r
1007 \r
1008 \r
1009 \r
1010 Myers & Rose                Standards Track                    [Page 18]\r
1011 \f\r
1012 RFC 1939                          POP3                          May 1996\r
1013 \r
1014 \r
1015 10. Example POP3 Session\r
1016 \r
1017       S: <wait for connection on TCP port 110>\r
1018       C: <open connection>\r
1019       S:    +OK POP3 server ready <1896.697170952@dbc.mtview.ca.us>\r
1020       C:    APOP mrose c4c9334bac560ecc979e58001b3e22fb\r
1021       S:    +OK mrose's maildrop has 2 messages (320 octets)\r
1022       C:    STAT\r
1023       S:    +OK 2 320\r
1024       C:    LIST\r
1025       S:    +OK 2 messages (320 octets)\r
1026       S:    1 120\r
1027       S:    2 200\r
1028       S:    .\r
1029       C:    RETR 1\r
1030       S:    +OK 120 octets\r
1031       S:    <the POP3 server sends message 1>\r
1032       S:    .\r
1033       C:    DELE 1\r
1034       S:    +OK message 1 deleted\r
1035       C:    RETR 2\r
1036       S:    +OK 200 octets\r
1037       S:    <the POP3 server sends message 2>\r
1038       S:    .\r
1039       C:    DELE 2\r
1040       S:    +OK message 2 deleted\r
1041       C:    QUIT\r
1042       S:    +OK dewey POP3 server signing off (maildrop empty)\r
1043       C:  <close connection>\r
1044       S:  <wait for next connection>\r
1045 \r
1046 11. Message Format\r
1047 \r
1048    All messages transmitted during a POP3 session are assumed to conform\r
1049    to the standard for the format of Internet text messages [RFC822].\r
1050 \r
1051    It is important to note that the octet count for a message on the\r
1052    server host may differ from the octet count assigned to that message\r
1053    due to local conventions for designating end-of-line.  Usually,\r
1054    during the AUTHORIZATION state of the POP3 session, the POP3 server\r
1055    can calculate the size of each message in octets when it opens the\r
1056    maildrop.  For example, if the POP3 server host internally represents\r
1057    end-of-line as a single character, then the POP3 server simply counts\r
1058    each occurrence of this character in a message as two octets.  Note\r
1059    that lines in the message which start with the termination octet need\r
1060    not (and must not) be counted twice, since the POP3 client will\r
1061    remove all byte-stuffed termination characters when it receives a\r
1062    multi-line response.\r
1063 \r
1064 \r
1065 \r
1066 Myers & Rose                Standards Track                    [Page 19]\r
1067 \f\r
1068 RFC 1939                          POP3                          May 1996\r
1069 \r
1070 \r
1071 12. References\r
1072 \r
1073    [RFC821] Postel, J., "Simple Mail Transfer Protocol", STD 10, RFC\r
1074        821, USC/Information Sciences Institute, August 1982.\r
1075 \r
1076    [RFC822] Crocker, D., "Standard for the Format of ARPA-Internet Text\r
1077        Messages", STD 11, RFC 822, University of Delaware, August 1982.\r
1078 \r
1079    [RFC1321] Rivest, R., "The MD5 Message-Digest Algorithm", RFC 1321,\r
1080        MIT Laboratory for Computer Science, April 1992.\r
1081 \r
1082    [RFC1730] Crispin, M., "Internet Message Access Protocol - Version\r
1083        4", RFC 1730, University of Washington, December 1994.\r
1084 \r
1085    [RFC1734] Myers, J., "POP3 AUTHentication command", RFC 1734,\r
1086        Carnegie Mellon, December 1994.\r
1087 \r
1088 13. Security Considerations\r
1089 \r
1090    It is conjectured that use of the APOP command provides origin\r
1091    identification and replay protection for a POP3 session.\r
1092    Accordingly, a POP3 server which implements both the PASS and APOP\r
1093    commands should not allow both methods of access for a given user;\r
1094    that is, for a given mailbox name, either the USER/PASS command\r
1095    sequence or the APOP command is allowed, but not both.\r
1096 \r
1097    Further, note that as the length of the shared secret increases, so\r
1098    does the difficulty of deriving it.\r
1099 \r
1100    Servers that answer -ERR to the USER command are giving potential\r
1101    attackers clues about which names are valid.\r
1102 \r
1103    Use of the PASS command sends passwords in the clear over the\r
1104    network.\r
1105 \r
1106    Use of the RETR and TOP commands sends mail in the clear over the\r
1107    network.\r
1108 \r
1109    Otherwise, security issues are not discussed in this memo.\r
1110 \r
1111 14. Acknowledgements\r
1112 \r
1113    The POP family has a long and checkered history.  Although primarily\r
1114    a minor revision to RFC 1460, POP3 is based on the ideas presented in\r
1115    RFCs 918, 937, and 1081.\r
1116 \r
1117    In addition, Alfred Grimstad, Keith McCloghrie, and Neil Ostroff\r
1118    provided significant comments on the APOP command.\r
1119 \r
1120 \r
1121 \r
1122 Myers & Rose                Standards Track                    [Page 20]\r
1123 \f\r
1124 RFC 1939                          POP3                          May 1996\r
1125 \r
1126 \r
1127 15. Authors' Addresses\r
1128 \r
1129    John G. Myers\r
1130    Carnegie-Mellon University\r
1131    5000 Forbes Ave\r
1132    Pittsburgh, PA 15213\r
1133 \r
1134    EMail: jgm+@cmu.edu\r
1135 \r
1136 \r
1137    Marshall T. Rose\r
1138    Dover Beach Consulting, Inc.\r
1139    420 Whisman Court\r
1140    Mountain View, CA  94043-2186\r
1141 \r
1142    EMail: mrose@dbc.mtview.ca.us\r
1143 \r
1144 \r
1145 \r
1146 \r
1147 \r
1148 \r
1149 \r
1150 \r
1151 \r
1152 \r
1153 \r
1154 \r
1155 \r
1156 \r
1157 \r
1158 \r
1159 \r
1160 \r
1161 \r
1162 \r
1163 \r
1164 \r
1165 \r
1166 \r
1167 \r
1168 \r
1169 \r
1170 \r
1171 \r
1172 \r
1173 \r
1174 \r
1175 \r
1176 \r
1177 \r
1178 Myers & Rose                Standards Track                    [Page 21]\r
1179 \f\r
1180 RFC 1939                          POP3                          May 1996\r
1181 \r
1182 \r
1183 Appendix A. Differences from RFC 1725\r
1184 \r
1185    This memo is a revision to RFC 1725, a Draft Standard.  It makes the\r
1186    following changes from that document:\r
1187 \r
1188       - clarifies that command keywords are case insensitive.\r
1189 \r
1190       - specifies that servers must send "+OK" and "-ERR" in\r
1191         upper case.\r
1192 \r
1193       - specifies that the initial greeting is a positive response,\r
1194         instead of any string which should be a positive response.\r
1195 \r
1196       - clarifies behavior for unimplemented commands.\r
1197 \r
1198       - makes the USER and PASS commands optional.\r
1199 \r
1200       - clarified the set of possible responses to the USER command.\r
1201 \r
1202       - reverses the order of the examples in the USER and PASS\r
1203         commands, to reduce confusion.\r
1204 \r
1205       - clarifies that the PASS command may only be given immediately\r
1206         after a successful USER command.\r
1207 \r
1208       - clarified the persistence requirements of UIDs and added some\r
1209         implementation notes.\r
1210 \r
1211       - specifies a UID length limitation of one to 70 octets.\r
1212 \r
1213       - specifies a status indicator length limitation\r
1214         of 512 octets, including the CRLF.\r
1215 \r
1216       - clarifies that LIST with no arguments on an empty mailbox\r
1217         returns success.\r
1218 \r
1219       - adds a reference from the LIST command to the Message Format\r
1220         section\r
1221 \r
1222       - clarifies the behavior of QUIT upon failure\r
1223 \r
1224       - clarifies the security section to not imply the use of the\r
1225         USER command with the APOP command.\r
1226 \r
1227       - adds references to RFCs 1730 and 1734\r
1228 \r
1229       - clarifies the method by which a UA may enter mail into the\r
1230         transport system.\r
1231 \r
1232 \r
1233 \r
1234 Myers & Rose                Standards Track                    [Page 22]\r
1235 \f\r
1236 RFC 1939                          POP3                          May 1996\r
1237 \r
1238 \r
1239       - clarifies that the second argument to the TOP command is a\r
1240         number of lines.\r
1241 \r
1242       - changes the suggestion in the Security Considerations section\r
1243         for a server to not accept both PASS and APOP for a given user\r
1244         from a "must" to a "should".\r
1245 \r
1246       - adds a section on scaling and operational considerations\r
1247 \r
1248 Appendix B. Command Index\r
1249 \r
1250        APOP .......................................................   15\r
1251        DELE .......................................................    8\r
1252        LIST .......................................................    6\r
1253        NOOP .......................................................    9\r
1254        PASS .......................................................   14\r
1255        QUIT .......................................................    5\r
1256        QUIT .......................................................   10\r
1257        RETR .......................................................    8\r
1258        RSET .......................................................    9\r
1259        STAT .......................................................    6\r
1260        TOP ........................................................   11\r
1261        UIDL .......................................................   12\r
1262        USER .......................................................   13\r
1263 \r
1264 \r
1265 \r
1266 \r
1267 \r
1268 \r
1269 \r
1270 \r
1271 \r
1272 \r
1273 \r
1274 \r
1275 \r
1276 \r
1277 \r
1278 \r
1279 \r
1280 \r
1281 \r
1282 \r
1283 \r
1284 \r
1285 \r
1286 \r
1287 \r
1288 \r
1289 \r
1290 Myers & Rose                Standards Track                    [Page 23]\r
1291 \f\r