;;; pop3.el --- Post Office Protocol (RFC 1460) interface
-;; Copyright (C) 1996, 97, 98, 1999 Free Software Foundation, Inc.
+;; Copyright (C) 1996, 1997, 1998, 1999, 2000
+;; Free Software Foundation, Inc.
;; Author: Richard L. Pieri <ratinox@peorth.gweep.net>
;; Daiki Ueno <ueno@ueda.info.waseda.ac.jp>
(autoload 'starttls-open-stream "starttls")
(autoload 'starttls-negotiate "starttls"))
+(defvar pop3-ssl-program-name
+ (if (exec-installed-p "openssl")
+ "openssl"
+ "ssleay")
+ "The program to run in a subprocess to open an SSL connection.")
+
(defvar pop3-ssl-program-arguments
'("s_client" "-quiet")
"Arguments to be passed to the program `pop3-ssl-program-name'.")
Argument PORT specifies connecting port."
(let (process)
(save-excursion
- (set-buffer (get-buffer-create (concat " trace of POP session to %s"
+ (set-buffer (get-buffer-create (concat " trace of POP session to "
mailhost)))
(erase-buffer)
(setq pop3-read-point (point-min))
(defun pop3-open-ssl-stream-1 (name buffer host service extra-arg)
(require 'path-util)
(let* ((ssl-program-name
- (cond ((exec-installed-p "openssl")
- "openssl")
- (t
- "ssleay")))
+ pop3-ssl-program-name)
(ssl-program-arguments
`(,@pop3-ssl-program-arguments ,extra-arg
"-connect" ,(format "%s:%d" host service)))
(setq From_ (concat (substring From_ 0 (match-beginning 0))
(substring From_ (match-end 0)))))
(goto-char (point-min))
- (insert From_))))))
+ (insert From_)
+ (if (search-forward "\n\n" nil t)
+ nil
+ (goto-char (point-max))
+ (insert "\n"))
+ (narrow-to-region (point) (point-max))
+ (let ((size (- (point-max) (point-min))))
+ (goto-char (point-min))
+ (widen)
+ (forward-line -1)
+ (insert (format "Content-Length: %s\n" size)))
+ )))))
;; UIDL support
(lambda (atom)
(when (car (symbol-value atom))
(insert (format "%s\n" atom))))
- pop3-uidl-obarray)))))
-
+ pop3-uidl-obarray)))
+ (fillarray pop3-uidl-obarray 0)))
+
;; The Command Set
(save-excursion
(set-buffer (process-buffer process))
(goto-char (point-max))
- (delete-process process)
- ))
- (when pop3-leave-mail-on-server
- (mapatoms
- (lambda (atom)
- (when (car (symbol-value atom))
- (unintern atom pop3-uidl-obarray)))
- pop3-uidl-obarray)))
+ (delete-process process))))
(defun pop3-uidl (process &optional msgno)
"Return the results of a UIDL command in PROCESS for optional MSGNO.