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