54c2170383606d6d5fe1b370364237ecb6c4a023
[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     (unless (memq (process-status process) '(open run))
182       (error "pop3 process died"))
183     (when total-size
184       (message "pop3 retrieved %dKB (%d%%)"
185                (truncate (/ (buffer-size) 1000))
186                (truncate (* (/ (* (buffer-size) 1.0)
187                                total-size) 100))))
188     (pop3-accept-process-output process)))
189
190 (defun pop3-write-to-file (file)
191   (let ((pop-buffer (current-buffer))
192         (start (point-min))
193         beg end
194         temp-buffer)
195     (with-temp-buffer
196       (setq temp-buffer (current-buffer))
197       (with-current-buffer pop-buffer
198         (goto-char (point-min))
199         (while (re-search-forward "^\\+OK" nil t)
200           (forward-line 1)
201           (setq beg (point))
202           (when (re-search-forward "^\\.\r?\n" nil t)
203             (setq start (point))
204             (forward-line -1)
205             (setq end (point)))
206           (with-current-buffer temp-buffer
207             (goto-char (point-max))
208             (let ((hstart (point)))
209               (insert-buffer-substring pop-buffer beg end)
210               (pop3-clean-region hstart (point))
211               (goto-char (point-max))
212               (pop3-munge-message-separator hstart (point))
213               (goto-char (point-max))))))
214       (let ((coding-system-for-write 'binary))
215         (goto-char (point-min))
216         ;; Check whether something inserted a newline at the start and
217         ;; delete it.
218         (when (eolp)
219           (delete-char 1))
220         (write-region (point-min) (point-max) file nil 'nomesg)))))
221
222 (defun pop3-number-of-responses (endp)
223   (let ((responses 0))
224     (save-excursion
225       (goto-char (point-min))
226       (while (or (and (re-search-forward "^\\+OK" nil t)
227                       (or (not endp)
228                           (re-search-forward "^\\.\r?\n" nil t)))
229                  (re-search-forward "^-ERR " nil t))
230         (incf responses)))
231     responses))
232
233 (defun pop3-logon (process)
234   (let ((pop3-password pop3-password))
235     ;; for debugging only
236     (if pop3-debug (switch-to-buffer (process-buffer process)))
237     ;; query for password
238     (if (and pop3-password-required (not pop3-password))
239         (setq pop3-password
240               (read-passwd (format "Password for %s: " pop3-maildrop))))
241     (cond ((equal 'apop pop3-authentication-scheme)
242            (pop3-apop process pop3-maildrop))
243           ((equal 'pass pop3-authentication-scheme)
244            (pop3-user process pop3-maildrop)
245            (pop3-pass process))
246           (t (error "Invalid POP3 authentication scheme")))))
247
248 (defun pop3-get-message-count ()
249   "Return the number of messages in the maildrop."
250   (let* ((process (pop3-open-server pop3-mailhost pop3-port))
251          message-count
252          (pop3-password pop3-password))
253     ;; for debugging only
254     (if pop3-debug (switch-to-buffer (process-buffer process)))
255     ;; query for password
256     (if (and pop3-password-required (not pop3-password))
257         (setq pop3-password
258               (read-passwd (format "Password for %s: " pop3-maildrop))))
259     (cond ((equal 'apop pop3-authentication-scheme)
260            (pop3-apop process pop3-maildrop))
261           ((equal 'pass pop3-authentication-scheme)
262            (pop3-user process pop3-maildrop)
263            (pop3-pass process))
264           (t (error "Invalid POP3 authentication scheme")))
265     (setq message-count (car (pop3-stat process)))
266     (pop3-quit process)
267     message-count))
268
269 (defcustom pop3-stream-type nil
270   "*Transport security type for POP3 connexions.
271 This may be either nil (plain connexion), `ssl' (use an
272 SSL/TSL-secured stream) or `starttls' (use the starttls mechanism
273 to turn on TLS security after opening the stream).  However, if
274 this is nil, `ssl' is assumed for connexions to port
275 995 (pop3s)."
276   :version "23.1" ;; No Gnus
277   :group 'pop3
278   :type '(choice (const :tag "Plain" nil)
279                  (const :tag "SSL/TLS" ssl)
280                  (const starttls)))
281
282 (eval-and-compile
283   (if (fboundp 'set-process-query-on-exit-flag)
284       (defalias 'pop3-set-process-query-on-exit-flag
285         'set-process-query-on-exit-flag)
286     (defalias 'pop3-set-process-query-on-exit-flag
287       'process-kill-without-query)))
288
289 (defun pop3-open-server (mailhost port)
290   "Open TCP connection to MAILHOST on PORT.
291 Returns the process associated with the connection."
292   (let ((coding-system-for-read 'binary)
293         (coding-system-for-write 'binary)
294         result)
295     (with-current-buffer
296         (get-buffer-create (concat " trace of POP session to "
297                                    mailhost))
298       (erase-buffer)
299       (setq pop3-read-point (point-min))
300       (setq result
301             (open-protocol-stream
302              "POP" (current-buffer) mailhost port
303              :type (cond
304                     ((or (eq pop3-stream-type 'ssl)
305                          (and (not pop3-stream-type)
306                               (member port '(995 "pop3s"))))
307                      'tls)
308                     (t
309                      (or pop3-stream-type 'network)))
310              :capability-command "CAPA\r\n"
311              :end-of-command "^\\(-ERR\\|+OK \\).*\n"
312              :end-of-capability "^\\.\r?\n\\|^-ERR"
313              :success "^\\+OK.*\n"
314              :return-list t
315              :starttls-function
316              (lambda (capabilities)
317                (and (string-match "\\bSTLS\\b" capabilities)
318                     "STLS\r\n"))))
319       (when result
320         (let ((response (plist-get (cdr result) :greeting)))
321           (setq pop3-timestamp
322                 (substring response (or (string-match "<" response) 0)
323                            (+ 1 (or (string-match ">" response) -1)))))
324         (pop3-set-process-query-on-exit-flag (car result) nil)
325         (erase-buffer)
326         (car result)))))
327
328 ;; Support functions
329
330 (defun pop3-send-command (process command)
331   (set-buffer (process-buffer process))
332   (goto-char (point-max))
333   ;; (if (= (aref command 0) ?P)
334   ;;     (insert "PASS <omitted>\r\n")
335   ;;   (insert command "\r\n"))
336   (setq pop3-read-point (point))
337   (goto-char (point-max))
338   (process-send-string process (concat command "\r\n")))
339
340 (defun pop3-read-response (process &optional return)
341   "Read the response from the server.
342 Return the response string if optional second argument is non-nil."
343   (let ((case-fold-search nil)
344         match-end)
345     (with-current-buffer (process-buffer process)
346       (goto-char pop3-read-point)
347       (while (and (memq (process-status process) '(open run))
348                   (not (search-forward "\r\n" nil t)))
349         (pop3-accept-process-output process)
350         (goto-char pop3-read-point))
351       (setq match-end (point))
352       (goto-char pop3-read-point)
353       (if (looking-at "-ERR")
354           (error "%s" (buffer-substring (point) (- match-end 2)))
355         (if (not (looking-at "+OK"))
356             (progn (setq pop3-read-point match-end) nil)
357           (setq pop3-read-point match-end)
358           (if return
359               (buffer-substring (point) match-end)
360             t)
361           )))))
362
363 (defun pop3-clean-region (start end)
364   (setq end (set-marker (make-marker) end))
365   (save-excursion
366     (goto-char start)
367     (while (and (< (point) end) (search-forward "\r\n" end t))
368       (replace-match "\n" t t))
369     (goto-char start)
370     (while (and (< (point) end) (re-search-forward "^\\." end t))
371       (replace-match "" t t)
372       (forward-char)))
373   (set-marker end nil))
374
375 ;; Copied from message-make-date.
376 (defun pop3-make-date (&optional now)
377   "Make a valid date header.
378 If NOW, use that time instead."
379   (require 'parse-time)
380   (let* ((now (or now (current-time)))
381          (zone (nth 8 (decode-time now)))
382          (sign "+"))
383     (when (< zone 0)
384       (setq sign "-")
385       (setq zone (- zone)))
386     (concat
387      (format-time-string "%d" now)
388      ;; The month name of the %b spec is locale-specific.  Pfff.
389      (format " %s "
390              (capitalize (car (rassoc (nth 4 (decode-time now))
391                                       parse-time-months))))
392      (format-time-string "%Y %H:%M:%S " now)
393      ;; We do all of this because XEmacs doesn't have the %z spec.
394      (format "%s%02d%02d" sign (/ zone 3600) (/ (% zone 3600) 60)))))
395
396 (defun pop3-munge-message-separator (start end)
397   "Check to see if a message separator exists.  If not, generate one."
398   (save-excursion
399     (save-restriction
400       (narrow-to-region start end)
401       (goto-char (point-min))
402       (if (not (or (looking-at "From .?") ; Unix mail
403                    (looking-at "\001\001\001\001\n") ; MMDF
404                    (looking-at "BABYL OPTIONS:") ; Babyl
405                    ))
406           (let* ((from (mail-strip-quoted-names (mail-fetch-field "From")))
407                  (tdate (mail-fetch-field "Date"))
408                  (date (split-string (or (and tdate
409                                               (not (string= "" tdate))
410                                               tdate)
411                                          (pop3-make-date))
412                                      " "))
413                  (From_))
414             ;; sample date formats I have seen
415             ;; Date: Tue, 9 Jul 1996 09:04:21 -0400 (EDT)
416             ;; Date: 08 Jul 1996 23:22:24 -0400
417             ;; should be
418             ;; Tue Jul 9 09:04:21 1996
419
420             ;; Fixme: This should use timezone on the date field contents.
421             (setq date
422                   (cond ((not date)
423                          "Tue Jan 1 00:00:0 1900")
424                         ((string-match "[A-Z]" (nth 0 date))
425                          (format "%s %s %s %s %s"
426                                  (nth 0 date) (nth 2 date) (nth 1 date)
427                                  (nth 4 date) (nth 3 date)))
428                         (t
429                          ;; this really needs to be better but I don't feel
430                          ;; like writing a date to day converter.
431                          (format "Sun %s %s %s %s"
432                                  (nth 1 date) (nth 0 date)
433                                  (nth 3 date) (nth 2 date)))
434                         ))
435             (setq From_ (format "\nFrom %s  %s\n" from date))
436             (while (string-match "," From_)
437               (setq From_ (concat (substring From_ 0 (match-beginning 0))
438                                   (substring From_ (match-end 0)))))
439             (goto-char (point-min))
440             (insert From_)
441             (if (search-forward "\n\n" nil t)
442                 nil
443               (goto-char (point-max))
444               (insert "\n"))
445             (let ((size (- (point-max) (point))))
446               (forward-line -1)
447               (insert (format "Content-Length: %s\n" size)))
448             )))))
449
450 ;; The Command Set
451
452 ;; AUTHORIZATION STATE
453
454 (defun pop3-user (process user)
455   "Send USER information to POP3 server."
456   (pop3-send-command process (format "USER %s" user))
457   (let ((response (pop3-read-response process t)))
458     (if (not (and response (string-match "+OK" response)))
459         (error "USER %s not valid" user))))
460
461 (defun pop3-pass (process)
462   "Send authentication information to the server."
463   (pop3-send-command process (format "PASS %s" pop3-password))
464   (let ((response (pop3-read-response process t)))
465     (if (not (and response (string-match "+OK" response)))
466         (pop3-quit process))))
467
468 (defun pop3-apop (process user)
469   "Send alternate authentication information to the server."
470   (let ((pass pop3-password))
471     (if (and pop3-password-required (not pass))
472         (setq pass
473               (read-passwd (format "Password for %s: " pop3-maildrop))))
474     (if pass
475         (let ((hash (md5 (concat pop3-timestamp pass) nil nil 'binary)))
476           (pop3-send-command process (format "APOP %s %s" user hash))
477           (let ((response (pop3-read-response process t)))
478             (if (not (and response (string-match "+OK" response)))
479                 (pop3-quit process)))))
480     ))
481
482 ;; TRANSACTION STATE
483
484 (defun pop3-stat (process)
485   "Return the number of messages in the maildrop and the maildrop's size."
486   (pop3-send-command process "STAT")
487   (let ((response (pop3-read-response process t)))
488     (list (string-to-number (nth 1 (split-string response " ")))
489           (string-to-number (nth 2 (split-string response " "))))
490     ))
491
492 (defun pop3-list (process &optional msg)
493   "If MSG is nil, return an alist of (MESSAGE-ID . SIZE) pairs.
494 Otherwise, return the size of the message-id MSG"
495   (pop3-send-command process (if msg
496                                  (format "LIST %d" msg)
497                                "LIST"))
498   (let ((response (pop3-read-response process t)))
499     (if msg
500         (string-to-number (nth 2 (split-string response " ")))
501       (let ((start pop3-read-point) end)
502         (with-current-buffer (process-buffer process)
503           (while (not (re-search-forward "^\\.\r\n" nil t))
504             (pop3-accept-process-output process)
505             (goto-char start))
506           (setq pop3-read-point (point-marker))
507           (goto-char (match-beginning 0))
508           (setq end (point-marker))
509           (mapcar #'(lambda (s) (let ((split (split-string s " ")))
510                                   (cons (string-to-number (nth 0 split))
511                                         (string-to-number (nth 1 split)))))
512                   (split-string (buffer-substring start end) "\r\n" t)))))))
513
514 (defun pop3-retr (process msg crashbuf)
515   "Retrieve message-id MSG to buffer CRASHBUF."
516   (pop3-send-command process (format "RETR %s" msg))
517   (pop3-read-response process)
518   (let ((start pop3-read-point) end)
519     (with-current-buffer (process-buffer process)
520       (while (not (re-search-forward "^\\.\r\n" nil t))
521         (unless (memq (process-status process) '(open run))
522           (error "pop3 server closed the connection"))
523         (pop3-accept-process-output process)
524         (goto-char start))
525       (setq pop3-read-point (point-marker))
526       ;; this code does not seem to work for some POP servers...
527       ;; and I cannot figure out why not.
528       ;;      (goto-char (match-beginning 0))
529       ;;      (backward-char 2)
530       ;;      (if (not (looking-at "\r\n"))
531       ;;          (insert "\r\n"))
532       ;;      (re-search-forward "\\.\r\n")
533       (goto-char (match-beginning 0))
534       (setq end (point-marker))
535       (pop3-clean-region start end)
536       (pop3-munge-message-separator start end)
537       (with-current-buffer crashbuf
538         (erase-buffer))
539       (copy-to-buffer crashbuf start end)
540       (delete-region start end)
541       )))
542
543 (defun pop3-dele (process msg)
544   "Mark message-id MSG as deleted."
545   (pop3-send-command process (format "DELE %s" msg))
546   (pop3-read-response process))
547
548 (defun pop3-noop (process msg)
549   "No-operation."
550   (pop3-send-command process "NOOP")
551   (pop3-read-response process))
552
553 (defun pop3-last (process)
554   "Return highest accessed message-id number for the session."
555   (pop3-send-command process "LAST")
556   (let ((response (pop3-read-response process t)))
557     (string-to-number (nth 1 (split-string response " ")))
558     ))
559
560 (defun pop3-rset (process)
561   "Remove all delete marks from current maildrop."
562   (pop3-send-command process "RSET")
563   (pop3-read-response process))
564
565 ;; UPDATE
566
567 (defun pop3-quit (process)
568   "Close connection to POP3 server.
569 Tell server to remove all messages marked as deleted, unlock the maildrop,
570 and close the connection."
571   (pop3-send-command process "QUIT")
572   (pop3-read-response process t)
573   (if process
574       (with-current-buffer (process-buffer process)
575         (goto-char (point-max))
576         (delete-process process))))
577 \f
578 ;; Summary of POP3 (Post Office Protocol version 3) commands and responses
579
580 ;;; AUTHORIZATION STATE
581
582 ;; Initial TCP connection
583 ;; Arguments: none
584 ;; Restrictions: none
585 ;; Possible responses:
586 ;;  +OK [POP3 server ready]
587
588 ;; USER name
589 ;; Arguments: a server specific user-id (required)
590 ;; Restrictions: authorization state [after unsuccessful USER or PASS
591 ;; Possible responses:
592 ;;  +OK [valid user-id]
593 ;;  -ERR [invalid user-id]
594
595 ;; PASS string
596 ;; Arguments: a server/user-id specific password (required)
597 ;; Restrictions: authorization state, after successful USER
598 ;; Possible responses:
599 ;;  +OK [maildrop locked and ready]
600 ;;  -ERR [invalid password]
601 ;;  -ERR [unable to lock maildrop]
602
603 ;; STLS      (RFC 2595)
604 ;; Arguments: none
605 ;; Restrictions: Only permitted in AUTHORIZATION state.
606 ;; Possible responses:
607 ;;  +OK
608 ;;  -ERR
609
610 ;;; TRANSACTION STATE
611
612 ;; STAT
613 ;; Arguments: none
614 ;; Restrictions: transaction state
615 ;; Possible responses:
616 ;;  +OK nn mm [# of messages, size of maildrop]
617
618 ;; LIST [msg]
619 ;; Arguments: a message-id (optional)
620 ;; Restrictions: transaction state; msg must not be deleted
621 ;; Possible responses:
622 ;;  +OK [scan listing follows]
623 ;;  -ERR [no such message]
624
625 ;; RETR msg
626 ;; Arguments: a message-id (required)
627 ;; Restrictions: transaction state; msg must not be deleted
628 ;; Possible responses:
629 ;;  +OK [message contents follow]
630 ;;  -ERR [no such message]
631
632 ;; DELE msg
633 ;; Arguments: a message-id (required)
634 ;; Restrictions: transaction state; msg must not be deleted
635 ;; Possible responses:
636 ;;  +OK [message deleted]
637 ;;  -ERR [no such message]
638
639 ;; NOOP
640 ;; Arguments: none
641 ;; Restrictions: transaction state
642 ;; Possible responses:
643 ;;  +OK
644
645 ;; LAST
646 ;; Arguments: none
647 ;; Restrictions: transaction state
648 ;; Possible responses:
649 ;;  +OK nn [highest numbered message accessed]
650
651 ;; RSET
652 ;; Arguments: none
653 ;; Restrictions: transaction state
654 ;; Possible responses:
655 ;;  +OK [all delete marks removed]
656
657 ;;; UPDATE STATE
658
659 ;; QUIT
660 ;; Arguments: none
661 ;; Restrictions: none
662 ;; Possible responses:
663 ;;  +OK [TCP connection closed]
664
665 (provide 'pop3)
666
667 ;;; pop3.el ends here