Subject: bug#78996: 29.4; Invalid authinfo credentials when sending mail through SMTP

From: Eli Zaretskii <[email-masked]>
Date: Sun, 20 Jul 2025 07:34:53 +0300

> From: 8dcc <[email-masked]>
> Cc: [email-masked], [email-masked]
> Date: Sun, 20 Jul 2025 00:07:09 +0200
> 
> > 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?
> 
> I understand what you mean, but permanently modifying a global variable
> because I want to send a specific mail from a specific buffer doesn't
> seem right to me. For example, some other mode that uses SMTP could ends
> up accessing that same value, and since it's not hooked, it could end up
> using the email address from that one mail that I sent an hour ago,
> which is not my main one (i.e. what used to be the global value of
> `smtpmail-smtp-user').
> 
> I could perhaps save the old value in my own variable, and then restore
> it in another hook, but that's very hacky and doesn't feel right at all.

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.

Anyway, I think this bug can be closed now?