--- pop3.el.orig 2010-04-04 01:26:09.000000000 +0300 +++ pop3.el 2010-11-19 00:21:53.106967116 +0200 @@ -261,12 +261,6 @@ (setq port 110)) (let ((process (starttls-open-stream "POP" (current-buffer) mailhost (or port 110)))) - (pop3-send-command process "STLS") - (let ((response (pop3-read-response process t))) - (if (and response (string-match "+OK" response)) - (starttls-negotiate process) - (pop3-quit process) - (error "POP server doesn't support starttls"))) process)) (t (open-network-stream "POP" (current-buffer) mailhost port)))) @@ -274,6 +268,13 @@ (setq pop3-timestamp (substring response (or (string-match "<" response) 0) (+ 1 (or (string-match ">" response) -1))))) + (when (eq pop3-stream-type 'starttls) + (pop3-send-command process "STLS") + (let ((response (pop3-read-response process t))) + (if (and response (string-match "+OK" response)) + (starttls-negotiate process) + (pop3-quit process) + (error "POP server doesn't support starttls")))) process))) ;; Support functions