Debian Codegraph @

rfc1939.html

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