From 726b758005ead50e9c98ef50a59304646652b994 Mon Sep 17 00:00:00 2001 From: Andrew G Cohen Date: Sat, 29 Aug 2020 12:22:40 +0800 Subject: [PATCH] Allow direct choice of smtp authentication method * lisp/mail/smtpmail.el (smtpmail-try-auth-methods): Let the authorization credentials have an entry with key :smtp-auth containing a preferred authentication mechanism. --- lisp/mail/smtpmail.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lisp/mail/smtpmail.el b/lisp/mail/smtpmail.el index 666395e0b9e..1786608dd67 100644 --- a/lisp/mail/smtpmail.el +++ b/lisp/mail/smtpmail.el @@ -512,8 +512,9 @@ for `smtpmail-try-auth-method'.") (if port (format "%s" port) "smtp")) - (let* ((mechs (cdr-safe (assoc 'auth supported-extensions))) - (mech (car (smtpmail-intersection mechs smtpmail-auth-supported))) + (let* ((mechs (smtpmail-intersection + (cdr-safe (assoc 'auth supported-extensions)) + smtpmail-auth-supported)) (auth-source-creation-prompts '((user . "SMTP user name for %h: ") (secret . "SMTP password for %u@%h: "))) @@ -526,6 +527,7 @@ for `smtpmail-try-auth-method'.") :require (and ask-for-password '(:user :secret)) :create ask-for-password))) + (mech (or (plist-get auth-info :smtp-auth) (car mechs))) (user (plist-get auth-info :user)) (password (plist-get auth-info :secret)) (save-function (and ask-for-password -- 2.39.2