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