GNU bug report logs - #77866
30.0.50; message.el handling of non-ascii names in addresses

Previous Next

Package: emacs;

Reported by: Al Haji-Ali <abdo.haji.ali <at> gmail.com>

Date: Thu, 17 Apr 2025 13:01:04 UTC

Severity: normal

Tags: fixed

Found in version 30.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


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Al Haji-Ali <abdo.haji.ali <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 30.0.50; message.el handling of non-ascii names in addresses
Date: Thu, 17 Apr 2025 13:54:21 +0100
This is a bit difficult for me to reproduce as a user in a clean instance of Emacs, since I am seeing it in notmuch, which uses message.el, and I don't know how to use message.el without my setup of notmuch.
However, I am sure that I've identified the reason for the bug(?) in message.el and I hope my description below is sufficient.

I have an email with a header field like this:
CC: "Blanco, Raúl" <blanco <at> test.com>

with a non-ASCII character in the name. When I call `message-send-mail`, on 29.1 I get an error
`split-string: Wrong type argument: stringp, nil`

and on 30.0.50, I get the error
`Email address can't be parsed`

The reason is that `message-send-mail` calls `mail-encode-encoded-word-buffer`, which encodes that part of the message as:

CC: "Blanco, =?utf-8?Q?Ra=C3=BAl=22?= <blanco <at> test.com>

So that the quotation marks are no longer paired, and `mail-header-parse-addresses` splits the address into two ill-formed ones.

The code below extracts the relevant function calls from `message-send-mail` for an easy check (even on 'emacs -Q'):

,----
| (require 'message)
| (let ((case-fold-search nil))
|   (with-temp-buffer
|     (insert "CC: \"Blanco, Raúl\" <blanco <at> test.com>")
|     (mail-encode-encoded-word-buffer)
|     (cl-loop
|      for addr in
|      (mail-header-parse-addresses
|       (message-fetch-field "CC")
|       t)
|      collect (cons addr (textsec-suspicious-p addr 'email-address-header)))))
`----




This bug report was last modified 29 days ago.

Previous Next


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