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


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#78996: closed (29.4; Invalid authinfo credentials when
 sending mail through SMTP)
Date: Sun, 20 Jul 2025 11:50:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Sun, 20 Jul 2025 14:49:48 +0300
with message-id <86pldvcc9v.fsf <at> gnu.org>
and subject line Re: bug#78996: 29.4; Invalid authinfo credentials when sending mail through SMTP
has caused the debbugs.gnu.org bug report #78996,
regarding 29.4; Invalid authinfo credentials when sending mail through SMTP
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
78996: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=78996
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: 8dcc <8dcc.lists <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.4; Invalid authinfo credentials when sending mail through SMTP
Date: Fri, 11 Jul 2025 17:58:47 +0200
Hello,

I have been trying to write a simple Emacs Lisp function that lets me
select the credentials that are used when sending mail through
`compose-mail' with `message-send-mail-function' set to
`smtpmail-send-it'. I tried many things, including modifying the "From:"
field, and changing `user-mail-address' (both locally and
globally). Although the "From" header does indeed change to the right
value when sending the email, the credentials used when authenticating
with the SMTP server don't change; in the case of Gmail, this "From"
header gets overwritten and a new "X-Google-Original-From" header is
added.

I thought that the email that was used for authentication was the one I
had originally set as `user-mail-address', but it turns out that it
entirely depends on the order of the entries in my '~/authinfo.gpg'
file.

For example, if the contents of the file were:

    machine 127.0.0.1 login my-user port ssh password "****"
    machine smtp.gmail.com login foo <at> gmail.com password "****" port 465
    machine smtp.gmail.com login bar <at> gmail.com password "****" port 465

Then the credentials of "foo <at> gmail.com" would be used, since it's the
first line whose "machine" value matches the value of my
`smtpmail-smtp-server' variable.

Please let me know if you need any more information.

Thank you,
8dcc.


[Message part 3 (message/rfc822, inline)]
From: Eli Zaretskii <eliz <at> gnu.org>
To: 8dcc <8dcc.git <at> gmail.com>
Cc: 78996-done <at> debbugs.gnu.org
Subject: Re: bug#78996: 29.4;
 Invalid authinfo credentials when sending mail through SMTP
Date: Sun, 20 Jul 2025 14:49:48 +0300
> From: 8dcc <8dcc.git <at> gmail.com>
> Cc: 78996 <at> debbugs.gnu.org
> Date: Sun, 20 Jul 2025 12:21:40 +0200
> 
> > You have message-send-hook and message-sent-hook to do this.
> >
> > I don't understand why this is hacky, since your original code was
> > also in a hook.
> 
> I think modifying a global variable permanently from within a hook is
> hacky, and I think saving it in a temporary variable across hooks is
> also a hacky work-around. That's just my opinion.

Understood.

> > Anyway, I think this bug can be closed now?
> 
> Yes. Thank you for your help!

Thanks, done.


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.