GNU bug report logs - #78996
29.4; Invalid authinfo credentials when sending mail through SMTP

Previous Next

Package: emacs;

Reported by: 8dcc <8dcc.lists <at> gmail.com>

Date: Sat, 12 Jul 2025 02:27:02 UTC

Severity: normal

Found in version 29.4

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #11 received at 78996 <at> debbugs.gnu.org (full text, mbox):

From: 8dcc <8dcc.lists <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 78996 <at> debbugs.gnu.org
Subject: Re: bug#78996: 29.4;
 Invalid authinfo credentials when sending mail through SMTP
Date: Sat, 19 Jul 2025 16:25:09 +0200
> My reading of smtpmail.el is that you should set the value of
> smtpmail-smtp-user to control the selection of credentials by login
> name.  Did you try that?

I have just tried that, and it only seems to work if I set it
globally. Specifically, I added the following hook:

    (add-hook
     'message-send-hook
     (lambda ()
       (let ((from (mail-fetch-field "from")))
         (when from
           (let* ((components (mail-extract-address-components from))
                  (name (car components))
                  (addr (cadr components)))
             (when name
               (setq-local user-full-name name))
             (when addr
               (setq-local user-mail-address addr
                           smtpmail-smtp-user addr)))))))

If I modify the "From" address in the `message-mode' buffer, it does in
fact locally change `smtpmail-smtp-user' to the correct value
(bar <at> gmail.com). I have an entry in my '~/.authinfo.gpg' with that
address after the "login" keyword, but it still authenticates with the
first entry.

If I manually evaluate:

    (setq smtpmail-smtp-user "bar <at> gmail.com")

It does work fine. Is this by design? Why doesn't it work if I use
`setq-local'?

Thank you.




This bug report was last modified 32 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.