GNU bug report logs -
#78996
29.4; Invalid authinfo credentials when sending mail through SMTP
Previous Next
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
View this message in rfc822 format
> From: 8dcc <8dcc.lists <at> gmail.com>
> Cc: 78996 <at> debbugs.gnu.org
> 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'?
Probably because smtpmail uses a different buffer for accessing the
authinfo? (That's a guess.)
But I don't understand why you cannot set the value globally. It
isn't like you need to send mail using several different credentials
at the same time, is it?
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.