Function: imap-starttls-open

imap-starttls-open is a byte-compiled function defined in imap.el.gz.

Signature

(imap-starttls-open NAME BUFFER SERVER PORT)

Source Code

;; Defined in /usr/src/emacs/lisp/net/imap.el.gz
(defun imap-starttls-open (name buffer server port)
  (message "imap: Connecting with STARTTLS...")
  (let* ((port (or port imap-default-port))
	 (coding-system-for-read imap-coding-system-for-read)
	 (coding-system-for-write imap-coding-system-for-write)
	 (process (open-network-stream
                   name buffer server port
                   :type 'starttls
                   :capability-command "1 CAPABILITY\r\n"
                   :always-query-capabilities t
                   :end-of-command "\r\n"
                   :success "^1 OK "
                   :starttls-function
                   (lambda (capabilities)
                     (when (string-match-p "STARTTLS" capabilities)
                       "1 STARTTLS\r\n"))))
         done)
    (when process
      (imap-log buffer)
      (when (memq (process-status process) '(open run))
        (setq done process)
        (with-current-buffer buffer
          (goto-char (point-min))
          (imap-parse-greeting))))
    (message "imap: Connecting with STARTTLS...%s" (if done "done" "failed"))
    done))