Function: rmail-get-remote-password
rmail-get-remote-password is a byte-compiled function defined in
rmail.el.gz.
Signature
(rmail-get-remote-password IMAP USER HOST)
Documentation
Get the password for retrieving mail from a POP or IMAP server.
If none has been set, the password is found via auth-source. If you use ~/.authinfo as your auth-source backend, then put something like the following in that file:
machine mymachine login myloginname password mypassword
If auth-source search yields no result, prompt the user for the password.
Source Code
;; Defined in /usr/src/emacs/lisp/mail/rmail.el.gz
(defun rmail-get-remote-password (imap user host)
"Get the password for retrieving mail from a POP or IMAP server.
If none has been set, the password is found via auth-source. If
you use ~/.authinfo as your auth-source backend, then put
something like the following in that file:
machine mymachine login myloginname password mypassword
If auth-source search yields no result, prompt the user for the
password."
(when (or (not rmail-encoded-remote-password)
(not (equal user rmail--remote-password-user))
(not (equal host rmail--remote-password-host)))
;; Record the values we will be using from now on.
(setq rmail--remote-password-host host
rmail--remote-password-user user)
(if (not rmail-remote-password)
(setq rmail-remote-password
(let ((found (nth 0 (auth-source-search
:max 1 :user user :host host
:require '(:secret)))))
(if found
(auth-info-password found)
(read-passwd (if imap
"IMAP password: "
"POP password: "))))))
(rmail-set-remote-password rmail-remote-password)
(setq rmail-remote-password nil))
(rmail-encode-string rmail-encoded-remote-password (emacs-pid)))