From 45bc42bddfe8d9376ede6e71e4ddccb02c3d45a3 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 23 Aug 2025 14:55:09 +0300 Subject: [PATCH] Rmail can fetch email from several inboxes with different passwords * lisp/mail/rmail.el (rmail--remote-password-host) (rmail--remote-password-user): New variables. (rmail-get-remote-password): Use them to ask for the password whenever we need to fetch email from an inbox whose user or host are different from the last ones. (Bug#79214) --- lisp/mail/rmail.el | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el index 41b0813707f..b8aa937aec2 100644 --- a/lisp/mail/rmail.el +++ b/lisp/mail/rmail.el @@ -4515,6 +4515,11 @@ TEXT and INDENT are not used." ;; to "prying eyes." Obviously, this encoding isn't "real security," ;; nor is it meant to be. +(defvar rmail--remote-password-host nil + "Last recorded value of the HOST argument to `rmail-get-remote-password'.") +(defvar rmail--remote-password-user nil + "Last recorded value of the USER argument to `rmail-get-remote-password'.") + ;;;###autoload (defun rmail-set-remote-password (password) "Set PASSWORD to be used for retrieving mail from a POP or IMAP server." @@ -4535,7 +4540,12 @@ machine mymachine login myloginname password mypassword If auth-source search yields no result, prompt the user for the password." - (when (not rmail-encoded-remote-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