Subject: bug#57373: 28.1; authinfo keyword smtp-auth does not work

From: Robert Pluim <[email-masked]>
Date: Wed, 24 Aug 2022 11:30:27 +0200

>>>>> On Tue, 23 Aug 2022 22:01:10 +0000, John Kehayias via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <[email-masked]> said:

    John> I believe the problem is that in smtpmail-try-auth-methods
    John> the smtp-auth keyword is read in by auth-source-search as a
    John> string, while the call to smtpmail-try-auth-method that uses
    John> it all match with eql, eg. as (eql 'plain).

Yep.

    John> I have tried different ways to get the smtp-auth value read
    John> differently in my authinfo, to no avail. Looking back at the
    John> devel mailing list, there was some confusion that this
    John> feature needed plstore, but in the end did not:
    John> <https://lists.gnu.org/archive/html/emacs-devel/2020-09/msg00002.html>
    John> I can confirm that reading the authinfo does provide the
    John> smtp-auth keyword, it just won't match any method to call.

    John> Perhaps there is a different format for specifying smtp-auth that I didn't find?

auth-source search always returns a plist containg strings as the key
values. Does the following work for you

diff --git a/lisp/mail/smtpmail.el b/lisp/mail/smtpmail.el
index c2f8f27377..8573532eac 100644
--- a/lisp/mail/smtpmail.el
+++ b/lisp/mail/smtpmail.el
@@ -577,7 +577,7 @@ smtpmail-try-auth-methods
                     (stringp result))
           (setq result (catch 'done
 		         (smtpmail-try-auth-method
-                          process (pop mechs) user password))))
+                          process (intern-soft (pop mechs)) user password))))
         ;; A string result is an error.
         (if (stringp result)
             (progn

Robert
--