GNU bug report logs - #75628
31.0.50; Error sending mail using SMTP - base64 encoding fails

Previous Next

Package: emacs;

Reported by: Ingo Brunberg <ingo_brunberg <at> web.de>

Date: Fri, 17 Jan 2025 10:20:02 UTC

Severity: normal

Tags: fixed

Found in version 31.0.50

Fixed in version 31.1

Done: Robert Pluim <rpluim <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Ingo Brunberg <ingo_brunberg <at> web.de>
To: Robert Pluim <rpluim <at> gmail.com>
Cc: 75628 <at> debbugs.gnu.org
Subject: bug#75628: 31.0.50; Error sending mail using SMTP - base64 encoding fails
Date: Fri, 17 Jan 2025 16:51:15 +0100
Hello Robert,

yes, your patch does indeed fix the issue. I also guess there are more
places which need that treatment. Glad, it works for me again.

Thanks
Ingo

Robert Pluim <rpluim <at> gmail.com> writes:

>>>>>> On Fri, 17 Jan 2025 10:18:52 +0000, Ingo Brunberg via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org> said:
>
>     Ingo> When I try to send mail with emacs using SMTP, I get error "Multibyte character
>     Ingo> in data for base64 encoding".
>
>     Ingo> In the current code I have narrowed it down to line 637 in smtpmail.el, where an
>     Ingo> attempt is made to base64 encode a string containing the password which, of
>     Ingo> course, can contain multibyte characters.
>
>     Ingo> With a simple password some time ago, I could send mail.
>
> Does this fix it? I guess at least "AUTH LOGIN" needs similar
> treatment, and probably "AUTH CRAM-MD5". I donʼt think XOAUTH2 needs
> it, but Iʼll check.
>
> diff --git a/lisp/mail/smtpmail.el b/lisp/mail/smtpmail.el
> index 6cb576fe72b..5aebbec14d0 100644
> --- a/lisp/mail/smtpmail.el
> +++ b/lisp/mail/smtpmail.el
> @@ -631,11 +631,12 @@ smtpmail-try-auth-method
>    ;; violate a SHOULD in RFC 2222 paragraph 5.1.  Note that this
>    ;; is not sent if the server did not advertise AUTH PLAIN in
>    ;; the EHLO response.  See RFC 2554 for more info.
> +  (let ((password (encode-coding-string password 'utf-8)))
>    (smtpmail-command-or-throw
>     process
>     (concat "AUTH PLAIN "
>  	   (base64-encode-string (concat "\0" user "\0" password) t))
> -   235))
> +   235)))
>  
>  (cl-defmethod smtpmail-try-auth-method
>    (process (_mech (eql 'xoauth2)) user password)
>
>
>
>
>
>
> Robert




This bug report was last modified 93 days ago.

Previous Next


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