Subject: Re: bug#75628: 31.0.50; Error sending mail using SMTP - base64 encoding fails

From: Robert Pluim <[email-masked]>
Date: Fri, 17 Jan 2025 14:26:53 +0100

>>>>> On Fri, 17 Jan 2025 14:55:55 +0200, Eli Zaretskii <[email-masked]> said:

    >> Date: Fri, 17 Jan 2025 10:18:52 +0000
    >> From:  Ingo Brunberg via "Bug reports for GNU Emacs,
    >> the Swiss army knife of text editors" <[email-masked]>
    >> 
    >> When I try to send mail with emacs using SMTP, I get error "Multibyte character
    >> in data for base64 encoding".
    >> 
    >> In the current code I have narrowed it down to line 637 in smtpmail.el, where an
    >> attempt is made to base64 encode a string containing the password which, of
    >> course, can contain multibyte characters.
    >> 
    >> With a simple password some time ago, I could send mail.

    Eli> Thanks, but please show a complete recipe, preferably starting from
    Eli> "emacs -Q".

    Eli> base64 encoding indeed requires its input to be a unibyte string, but
    Eli> it is impossible to guess how this failed to happen without seeing the
    Eli> sequence of commands you typed to trigger the problem.

If the password is coming from 'auth-source', it will be a multibyte
string:

ELISP> (auth-info-password (car (auth-source-search :host "test")))
"bär"

ELISP> (multibyte-string-p (auth-info-password (car (auth-source-search :host "test"))))
t

Robert
--