e29ddb0d44e6d8f3c79af91cbace26636bff6d0a
[gnus] / lisp / pop3.el
1 ;;; pop3.el --- Post Office Protocol (RFC 1460) interface
2
3 ;; Copyright (C) 1996-2011 Free Software Foundation, Inc.
4
5 ;; Author: Richard L. Pieri <ratinox@peorth.gweep.net>
6 ;; Maintainer: FSF
7 ;; Keywords: mail
8
9 ;; This file is part of GNU Emacs.
10
11 ;; GNU Emacs is free software: you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation, either version 3 of the License, or
14 ;; (at your option) any later version.
15
16 ;; GNU Emacs is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 ;; GNU General Public License for more details.
20
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
23
24 ;;; Commentary:
25
26 ;; Most of the standard Post Office Protocol version 3 (RFC 1460) commands
27 ;; are implemented.  The LIST command has not been implemented due to lack
28 ;; of actual usefulness.
29 ;; The optional POP3 command TOP has not been implemented.
30
31 ;; This program was inspired by Kyle E. Jones's vm-pop program.
32
33 ;;; Code:
34
35 (eval-when-compile (require 'cl))
36
37 (eval-and-compile
38   ;; In Emacs 24, `open-protocol-stream' is an autoloaded alias for
39   ;; `make-network-stream'.
40   (unless (fboundp 'open-protocol-stream)
41     (require 'proto-stream)))
42
43 (require 'mail-utils)
44 (defvar parse-time-months)
45
46 (defgroup pop3 nil
47   "Post Office Protocol."
48   :group 'mail
49   :group 'mail-source)
50
51 (defcustom pop3-maildrop (or (user-login-name)
52                              (getenv "LOGNAME")
53                              (getenv "USER"))
54   "*POP3 maildrop."
55   :version "22.1" ;; Oort Gnus
56   :type 'string
57   :group 'pop3)
58
59 (defcustom pop3-mailhost (or (getenv "MAILHOST") ;; nil -> mismatch
60                              "pop3")
61   "*POP3 mailhost."
62   :version "22.1" ;; Oort Gnus
63   :type 'string
64   :group 'pop3)
65
66 (defcustom pop3-port 110
67   "*POP3 port."
68   :version "22.1" ;; Oort Gnus
69   :type 'number
70   :group 'pop3)
71
72 (defcustom pop3-password-required t
73   "*Non-nil if a password is required when connecting to POP server."
74   :version "22.1" ;; Oort Gnus
75   :type 'boolean
76   :group 'pop3)
77
78 ;; Should this be customizable?
79 (defvar pop3-password nil
80   "*Password to use when connecting to POP server.")
81
82 (defcustom pop3-authentication-scheme 'pass
83   "*POP3 authentication scheme.
84 Defaults to `pass', for the standard USER/PASS authentication.  The other
85 valid value is 'apop'."
86   :type '(choice (const :tag "Normal user/password" pass)
87                  (const :tag "APOP" apop))
88   :version "22.1" ;; Oort Gnus
89   :group 'pop3)
90
91 (defcustom pop3-stream-length 100
92   "How many messages should be requested at one time.
93 The lower the number, the more latency-sensitive the fetching
94 will be.  If your pop3 server doesn't support streaming at all,
95 set this to 1."
96   :type 'number
97   :version "24.1"
98   :group 'pop3)
99
100 (defcustom pop3-leave-mail-on-server nil
101   "*Non-nil if the mail is to be left on the POP server after fetching.
102
103 If `pop3-leave-mail-on-server' is non-nil the mail is to be left
104 on the POP server after fetching.  Note that POP servers maintain
105 no state information between sessions, so what the client
106 believes is there and what is actually there may not match up.
107 If they do not, then you may get duplicate mails or the whole
108 thing can fall apart and leave you with a corrupt mailbox."
109   ;; We can't use the UILD support from XEmacs mail-lib or cvs.m17n.org:
110   ;; http://thread.gmane.org/v9lld8fml4.fsf@marauder.physik.uni-ulm.de
111   ;; http://thread.gmane.org/b9yy8hzy9ej.fsf@jpl.org
112   ;; Any volunteer to re-implement this?
113   :version "22.1" ;; Oort Gnus
114   :type 'boolean
115   :group 'pop3)
116
117 (defvar pop3-timestamp nil
118   "Timestamp returned when initially connected to the POP server.
119 Used for APOP authentication.")
120
121 (defvar pop3-read-point nil)
122 (defvar pop3-debug nil)
123
124 ;; Borrowed from nnheader-accept-process-output in nnheader.el.  See the
125 ;; comments there for explanations about the values.
126
127 (eval-and-compile
128   (if (and (fboundp 'nnheader-accept-process-output)
129            (boundp 'nnheader-read-timeout))
130       (defalias 'pop3-accept-process-output 'nnheader-accept-process-output)
131     ;; Borrowed from `nnheader.el':
132     (defvar pop3-read-timeout
133       (if (string-match "windows-nt\\|os/2\\|cygwin"
134                         (symbol-name system-type))
135           1.0
136         0.01)
137       "How long pop3 should wait between checking for the end of output.
138 Shorter values mean quicker response, but are more CPU intensive.")
139     (defun pop3-accept-process-output (process)
140       (accept-process-output
141        process
142        (truncate pop3-read-timeout)
143        (truncate (* (- pop3-read-timeout
144                        (truncate pop3-read-timeout))
145                     1000))))))
146
147 ;;;###autoload
148 (defun pop3-movemail (file)
149   "Transfer contents of a maildrop to the specified FILE.
150 Use streaming commands."
151   (let* ((process (pop3-open-server pop3-mailhost pop3-port))
152          message-count message-total-size)
153     (pop3-logon process)
154     (with-current-buffer (process-buffer process)
155       (let ((size (pop3-stat process)))
156         (setq message-count (car size)
157               message-total-size (cadr size)))
158       (when (> message-count 0)
159         (pop3-send-streaming-command
160          process "RETR" message-count message-total-size)
161         (pop3-write-to-file file)
162         (unless pop3-leave-mail-on-server
163           (pop3-send-streaming-command
164            process "DELE" message-count nil))))
165     (pop3-quit process)
166     t))
167
168 (defun pop3-send-streaming-command (process command count total-size)
169   (erase-buffer)
170   (let ((i 1))
171     (while (>= count i)
172       (process-send-string process (format "%s %d\r\n" command i))
173       ;; Only do 100 messages at a time to avoid pipe stalls.
174       (when (zerop (% i pop3-stream-length))
175         (pop3-wait-for-messages process i total-size))
176       (incf i)))
177   (pop3-wait-for-messages process count total-size))
178
179 (defun pop3-wait-for-messages (process count total-size)
180   (while (< (pop3-number-of-responses total-size) count)
181     (when total-size
182       (message "pop3 retrieved %dKB (%d%%)"
183                (truncate (/ (buffer-size) 1000))
184                (truncate (* (/ (* (buffer-size) 1.0)
185                                total-size) 100))))
186     (pop3-accept-process-output process)))
187
188 (defun pop3-write-to-file (file)
189   (let ((pop-buffer (current-buffer))
190         (start (point-min))
191         beg end
192         temp-buffer)
193     (with-temp-buffer
194       (setq temp-buffer (current-buffer))
195       (with-current-buffer pop-buffer
196         (goto-char (point-min))
197         (while (re-search-forward "^\\+OK" nil t)
198           (forward-line 1)
199           (setq beg (point))
200           (when (re-search-forward "^\\.\r?\n" nil t)
201             (setq start (point))
202             (forward-line -1)
203             (setq end (point)))
204           (with-current-buffer temp-buffer
205             (goto-char (point-max))
206             (let ((hstart (point)))
207               (insert-buffer-substring pop-buffer beg end)
208               (pop3-clean-region hstart (point))
209               (goto-char (point-max))
210               (pop3-munge-message-separator hstart (point))
211               (goto-char (point-max))))))
212       (let ((coding-system-for-write 'binary))
213         (goto-char (point-min))
214         ;; Check whether something inserted a newline at the start and
215         ;; delete it.
216         (when (eolp)
217           (delete-char 1))
218         (write-region (point-min) (point-max) file nil 'nomesg)))))
219
220 (defun pop3-number-of-responses (endp)
221   (let ((responses 0))
222     (save-excursion
223       (goto-char (point-min))
224       (while (or (and (re-search-forward "^\\+OK" nil t)
225                       (or (not endp)
226                           (re-search-forward "^\\.\r?\n" nil t)))
227                  (re-search-forward "^-ERR " nil t))
228         (incf responses)))
229     responses))
230
231 (defun pop3-logon (process)
232   (let ((pop3-password pop3-password))
233     ;; for debugging only
234     (if pop3-debug (switch-to-buffer (process-buffer process)))
235     ;; query for password
236     (if (and pop3-password-required (not pop3-password))
237         (setq pop3-password
238               (read-passwd (format "Password for %s: " pop3-maildrop))))
239     (cond ((equal 'apop pop3-authentication-scheme)
240            (pop3-apop process pop3-maildrop))
241           ((equal 'pass pop3-authentication-scheme)
242            (pop3-user process pop3-maildrop)
243            (pop3-pass process))
244           (t (error "Invalid POP3 authentication scheme")))))
245
246 (defun pop3-get-message-count ()
247   "Return the number of messages in the maildrop."
248   (let* ((process (pop3-open-server pop3-mailhost pop3-port))
249          message-count
250          (pop3-password pop3-password))
251     ;; for debugging only
252     (if pop3-debug (switch-to-buffer (process-buffer process)))
253     ;; query for password
254     (if (and pop3-password-required (not pop3-password))
255         (setq pop3-password
256               (read-passwd (format "Password for %s: " pop3-maildrop))))
257     (cond ((equal 'apop pop3-authentication-scheme)
258            (pop3-apop process pop3-maildrop))
259           ((equal 'pass pop3-authentication-scheme)
260            (pop3-user process pop3-maildrop)
261            (pop3-pass process))
262           (t (error "Invalid POP3 authentication scheme")))
263     (setq message-count (car (pop3-stat process)))
264     (pop3-quit process)
265     message-count))
266
267 (defcustom pop3-stream-type nil
268   "*Transport security type for POP3 connexions.
269 This may be either nil (plain connexion), `ssl' (use an
270 SSL/TSL-secured stream) or `starttls' (use the starttls mechanism
271 to turn on TLS security after opening the stream).  However, if
272 this is nil, `ssl' is assumed for connexions to port
273 995 (pop3s)."
274   :version "23.1" ;; No Gnus
275   :group 'pop3
276   :type '(choice (const :tag "Plain" nil)
277                  (const :tag "SSL/TLS" ssl)
278                  (const starttls)))
279
280 (eval-and-compile
281   (if (fboundp 'set-process-query-on-exit-flag)
282       (defalias 'pop3-set-process-query-on-exit-flag
283         'set-process-query-on-exit-flag)
284     (defalias 'pop3-set-process-query-on-exit-flag
285       'process-kill-without-query)))
286
287 (defun pop3-open-server (mailhost port)
288   "Open TCP connection to MAILHOST on PORT.
289 Returns the process associated with the connection."
290   (let ((coding-system-for-read 'binary)
291         (coding-system-for-write 'binary)
292         result)
293     (with-current-buffer
294         (get-buffer-create (concat " trace of POP session to "
295                                    mailhost))
296       (erase-buffer)
297       (setq pop3-read-point (point-min))
298       (setq result
299             (open-protocol-stream
300              "POP" (current-buffer) mailhost port
301              :type (cond
302                     ((or (eq pop3-stream-type 'ssl)
303                          (and (not pop3-stream-type)
304                               (member port '(995 "pop3s"))))
305                      'tls)
306                     (t
307                      (or pop3-stream-type 'network)))
308              :capability-command "CAPA\r\n"
309              :end-of-command "^\\(-ERR\\|+OK \\).*\n"
310              :end-of-capability "^\\.\r?\n\\|^-ERR"
311              :success "^\\+OK.*\n"
312              :return-list t
313              :starttls-function
314              (lambda (capabilities)
315                (and (string-match "\\bSTLS\\b" capabilities)
316                     "STLS\r\n"))))
317       (when result
318         (let ((response (plist-get (cdr result) :greeting)))
319           (setq pop3-timestamp
320                 (substring response (or (string-match "<" response) 0)
321                            (+ 1 (or (string-match ">" response) -1)))))
322         (pop3-set-process-query-on-exit-flag (car result) nil)
323         (erase-buffer)
324         (car result)))))
325
326 ;; Support functions
327
328 (defun pop3-send-command (process command)
329   (set-buffer (process-buffer process))
330   (goto-char (point-max))
331   ;; (if (= (aref command 0) ?P)
332   ;;     (insert "PASS <omitted>\r\n")
333   ;;   (insert command "\r\n"))
334   (setq pop3-read-point (point))
335   (goto-char (point-max))
336   (process-send-string process (concat command "\r\n")))
337
338 (defun pop3-read-response (process &optional return)
339   "Read the response from the server.
340 Return the response string if optional second argument is non-nil."
341   (let ((case-fold-search nil)
342         match-end)
343     (with-current-buffer (process-buffer process)
344       (goto-char pop3-read-point)
345       (while (and (memq (process-status process) '(open run))
346                   (not (search-forward "\r\n" nil t)))
347         (pop3-accept-process-output process)
348         (goto-char pop3-read-point))
349       (setq match-end (point))
350       (goto-char pop3-read-point)
351       (if (looking-at "-ERR")
352           (error "%s" (buffer-substring (point) (- match-end 2)))
353         (if (not (looking-at "+OK"))
354             (progn (setq pop3-read-point match-end) nil)
355           (setq pop3-read-point match-end)
356           (if return
357               (buffer-substring (point) match-end)
358             t)
359           )))))
360
361 (defun pop3-clean-region (start end)
362   (setq end (set-marker (make-marker) end))
363   (save-excursion
364     (goto-char start)
365     (while (and (< (point) end) (search-forward "\r\n" end t))
366       (replace-match "\n" t t))
367     (goto-char start)
368     (while (and (< (point) end) (re-search-forward "^\\." end t))
369       (replace-match "" t t)
370       (forward-char)))
371   (set-marker end nil))
372
373 ;; Copied from message-make-date.
374 (defun pop3-make-date (&optional now)
375   "Make a valid date header.
376 If NOW, use that time instead."
377   (require 'parse-time)
378   (let* ((now (or now (current-time)))
379          (zone (nth 8 (decode-time now)))
380          (sign "+"))
381     (when (< zone 0)
382       (setq sign "-")
383       (setq zone (- zone)))
384     (concat
385      (format-time-string "%d" now)
386      ;; The month name of the %b spec is locale-specific.  Pfff.
387      (format " %s "
388              (capitalize (car (rassoc (nth 4 (decode-time now))
389                                       parse-time-months))))
390      (format-time-string "%Y %H:%M:%S " now)
391      ;; We do all of this because XEmacs doesn't have the %z spec.
392      (format "%s%02d%02d" sign (/ zone 3600) (/ (% zone 3600) 60)))))
393
394 (defun pop3-munge-message-separator (start end)
395   "Check to see if a message separator exists.  If not, generate one."
396   (save-excursion
397     (save-restriction
398       (narrow-to-region start end)
399       (goto-char (point-min))
400       (if (not (or (looking-at "From .?") ; Unix mail
401                    (looking-at "\001\001\001\001\n") ; MMDF
402                    (looking-at "BABYL OPTIONS:") ; Babyl
403                    ))
404           (let* ((from (mail-strip-quoted-names (mail-fetch-field "From")))
405                  (tdate (mail-fetch-field "Date"))
406                  (date (split-string (or (and tdate
407                                               (not (string= "" tdate))
408                                               tdate)
409                                          (pop3-make-date))
410                                      " "))
411                  (From_))
412             ;; sample date formats I have seen
413             ;; Date: Tue, 9 Jul 1996 09:04:21 -0400 (EDT)
414             ;; Date: 08 Jul 1996 23:22:24 -0400
415             ;; should be
416             ;; Tue Jul 9 09:04:21 1996
417
418             ;; Fixme: This should use timezone on the date field contents.
419             (setq date
420                   (cond ((not date)
421                          "Tue Jan 1 00:00:0 1900")
422                         ((string-match "[A-Z]" (nth 0 date))
423                          (format "%s %s %s %s %s"
424                                  (nth 0 date) (nth 2 date) (nth 1 date)
425                                  (nth 4 date) (nth 3 date)))
426                         (t
427                          ;; this really needs to be better but I don't feel
428                          ;; like writing a date to day converter.
429                          (format "Sun %s %s %s %s"
430                                  (nth 1 date) (nth 0 date)
431                                  (nth 3 date) (nth 2 date)))
432                         ))
433             (setq From_ (format "\nFrom %s  %s\n" from date))
434             (while (string-match "," From_)
435               (setq From_ (concat (substring From_ 0 (match-beginning 0))
436                                   (substring From_ (match-end 0)))))
437             (goto-char (point-min))
438             (insert From_)
439             (if (search-forward "\n\n" nil t)
440                 nil
441               (goto-char (point-max))
442               (insert "\n"))
443             (let ((size (- (point-max) (point))))
444               (forward-line -1)
445               (insert (format "Content-Length: %s\n" size)))
446             )))))
447
448 ;; The Command Set
449
450 ;; AUTHORIZATION STATE
451
452 (defun pop3-user (process user)
453   "Send USER information to POP3 server."
454   (pop3-send-command process (format "USER %s" user))
455   (let ((response (pop3-read-response process t)))
456     (if (not (and response (string-match "+OK" response)))
457         (error "USER %s not valid" user))))
458
459 (defun pop3-pass (process)
460   "Send authentication information to the server."
461   (pop3-send-command process (format "PASS %s" pop3-password))
462   (let ((response (pop3-read-response process t)))
463     (if (not (and response (string-match "+OK" response)))
464         (pop3-quit process))))
465
466 (defun pop3-apop (process user)
467   "Send alternate authentication information to the server."
468   (let ((pass pop3-password))
469     (if (and pop3-password-required (not pass))
470         (setq pass
471               (read-passwd (format "Password for %s: " pop3-maildrop))))
472     (if pass
473         (let ((hash (md5 (concat pop3-timestamp pass) nil nil 'binary)))
474           (pop3-send-command process (format "APOP %s %s" user hash))
475           (let ((response (pop3-read-response process t)))
476             (if (not (and response (string-match "+OK" response)))
477                 (pop3-quit process)))))
478     ))
479
480 ;; TRANSACTION STATE
481
482 (defun pop3-stat (process)
483   "Return the number of messages in the maildrop and the maildrop's size."
484   (pop3-send-command process "STAT")
485   (let ((response (pop3-read-response process t)))
486     (list (string-to-number (nth 1 (split-string response " ")))
487           (string-to-number (nth 2 (split-string response " "))))
488     ))
489
490 (defun pop3-list (process &optional msg)
491   "If MSG is nil, return an alist of (MESSAGE-ID . SIZE) pairs.
492 Otherwise, return the size of the message-id MSG"
493   (pop3-send-command process (if msg
494                                  (format "LIST %d" msg)
495                                "LIST"))
496   (let ((response (pop3-read-response process t)))
497     (if msg
498         (string-to-number (nth 2 (split-string response " ")))
499       (let ((start pop3-read-point) end)
500         (with-current-buffer (process-buffer process)
501           (while (not (re-search-forward "^\\.\r\n" nil t))
502             (pop3-accept-process-output process)
503             (goto-char start))
504           (setq pop3-read-point (point-marker))
505           (goto-char (match-beginning 0))
506           (setq end (point-marker))
507           (mapcar #'(lambda (s) (let ((split (split-string s " ")))
508                                   (cons (string-to-number (nth 0 split))
509                                         (string-to-number (nth 1 split)))))
510                   (split-string (buffer-substring start end) "\r\n" t)))))))
511
512 (defun pop3-retr (process msg crashbuf)
513   "Retrieve message-id MSG to buffer CRASHBUF."
514   (pop3-send-command process (format "RETR %s" msg))
515   (pop3-read-response process)
516   (let ((start pop3-read-point) end)
517     (with-current-buffer (process-buffer process)
518       (while (not (re-search-forward "^\\.\r\n" nil t))
519         (unless (memq (process-status process) '(open run))
520           (error "pop3 server closed the connection"))
521         (pop3-accept-process-output process)
522         (goto-char start))
523       (setq pop3-read-point (point-marker))
524       ;; this code does not seem to work for some POP servers...
525       ;; and I cannot figure out why not.
526       ;;      (goto-char (match-beginning 0))
527       ;;      (backward-char 2)
528       ;;      (if (not (looking-at "\r\n"))
529       ;;          (insert "\r\n"))
530       ;;      (re-search-forward "\\.\r\n")
531       (goto-char (match-beginning 0))
532       (setq end (point-marker))
533       (pop3-clean-region start end)
534       (pop3-munge-message-separator start end)
535       (with-current-buffer crashbuf
536         (erase-buffer))
537       (copy-to-buffer crashbuf start end)
538       (delete-region start end)
539       )))
540
541 (defun pop3-dele (process msg)
542   "Mark message-id MSG as deleted."
543   (pop3-send-command process (format "DELE %s" msg))
544   (pop3-read-response process))
545
546 (defun pop3-noop (process msg)
547   "No-operation."
548   (pop3-send-command process "NOOP")
549   (pop3-read-response process))
550
551 (defun pop3-last (process)
552   "Return highest accessed message-id number for the session."
553   (pop3-send-command process "LAST")
554   (let ((response (pop3-read-response process t)))
555     (string-to-number (nth 1 (split-string response " ")))
556     ))
557
558 (defun pop3-rset (process)
559   "Remove all delete marks from current maildrop."
560   (pop3-send-command process "RSET")
561   (pop3-read-response process))
562
563 ;; UPDATE
564
565 (defun pop3-quit (process)
566   "Close connection to POP3 server.
567 Tell server to remove all messages marked as deleted, unlock the maildrop,
568 and close the connection."
569   (pop3-send-command process "QUIT")
570   (pop3-read-response process t)
571   (if process
572       (with-current-buffer (process-buffer process)
573         (goto-char (point-max))
574         (delete-process process))))
575 \f
576 ;; Summary of POP3 (Post Office Protocol version 3) commands and responses
577
578 ;;; AUTHORIZATION STATE
579
580 ;; Initial TCP connection
581 ;; Arguments: none
582 ;; Restrictions: none
583 ;; Possible responses:
584 ;;  +OK [POP3 server ready]
585
586 ;; USER name
587 ;; Arguments: a server specific user-id (required)
588 ;; Restrictions: authorization state [after unsuccessful USER or PASS
589 ;; Possible responses:
590 ;;  +OK [valid user-id]
591 ;;  -ERR [invalid user-id]
592
593 ;; PASS string
594 ;; Arguments: a server/user-id specific password (required)
595 ;; Restrictions: authorization state, after successful USER
596 ;; Possible responses:
597 ;;  +OK [maildrop locked and ready]
598 ;;  -ERR [invalid password]
599 ;;  -ERR [unable to lock maildrop]
600
601 ;; STLS      (RFC 2595)
602 ;; Arguments: none
603 ;; Restrictions: Only permitted in AUTHORIZATION state.
604 ;; Possible responses:
605 ;;  +OK
606 ;;  -ERR
607
608 ;;; TRANSACTION STATE
609
610 ;; STAT
611 ;; Arguments: none
612 ;; Restrictions: transaction state
613 ;; Possible responses:
614 ;;  +OK nn mm [# of messages, size of maildrop]
615
616 ;; LIST [msg]
617 ;; Arguments: a message-id (optional)
618 ;; Restrictions: transaction state; msg must not be deleted
619 ;; Possible responses:
620 ;;  +OK [scan listing follows]
621 ;;  -ERR [no such message]
622
623 ;; RETR msg
624 ;; Arguments: a message-id (required)
625 ;; Restrictions: transaction state; msg must not be deleted
626 ;; Possible responses:
627 ;;  +OK [message contents follow]
628 ;;  -ERR [no such message]
629
630 ;; DELE msg
631 ;; Arguments: a message-id (required)
632 ;; Restrictions: transaction state; msg must not be deleted
633 ;; Possible responses:
634 ;;  +OK [message deleted]
635 ;;  -ERR [no such message]
636
637 ;; NOOP
638 ;; Arguments: none
639 ;; Restrictions: transaction state
640 ;; Possible responses:
641 ;;  +OK
642
643 ;; LAST
644 ;; Arguments: none
645 ;; Restrictions: transaction state
646 ;; Possible responses:
647 ;;  +OK nn [highest numbered message accessed]
648
649 ;; RSET
650 ;; Arguments: none
651 ;; Restrictions: transaction state
652 ;; Possible responses:
653 ;;  +OK [all delete marks removed]
654
655 ;;; UPDATE STATE
656
657 ;; QUIT
658 ;; Arguments: none
659 ;; Restrictions: none
660 ;; Possible responses:
661 ;;  +OK [TCP connection closed]
662
663 (provide 'pop3)
664
665 ;;; pop3.el ends here