Function: pop3-open-server
pop3-open-server is a byte-compiled function defined in pop3.el.gz.
Signature
(pop3-open-server MAILHOST PORT)
Documentation
Open TCP connection to MAILHOST on PORT.
Returns the process associated with the connection.
Source Code
;; Defined in /usr/src/emacs/lisp/net/pop3.el.gz
(defun pop3-open-server (mailhost port)
"Open TCP connection to MAILHOST on PORT.
Returns the process associated with the connection."
(let ((coding-system-for-read 'binary)
(coding-system-for-write 'binary)
result)
(with-current-buffer
(get-buffer-create (concat " trace of POP session to "
mailhost))
(erase-buffer)
(setq pop3-read-point (point-min))
(setq result
(open-network-stream
"POP" (current-buffer) mailhost port
:type (cond
((or (eq pop3-stream-type 'ssl)
(and (not pop3-stream-type)
(member port '(995 "pop3s"))))
'tls)
(t
(or pop3-stream-type 'network)))
:warn-unless-encrypted t
:capability-command "CAPA\r\n"
:end-of-command "^\\(-ERR\\|+OK\\).*\n"
:end-of-capability "^\\.\r?\n\\|^-ERR"
:success "^\\+OK.*\n"
:return-list t
:starttls-function
(lambda (capabilities)
(and (string-match "\\bSTLS\\b" capabilities)
"STLS\r\n"))))
(when result
(let ((response (plist-get (cdr result) :greeting)))
(setq pop3-timestamp
(substring response (or (string-search "<" response) 0)
(+ 1 (or (string-search ">" response) -1)))))
(set-process-query-on-exit-flag (car result) nil)
(erase-buffer)
(car result)))))