[Mailman-Users] diacritics in from header with from_is_list set to munge

Mark Sapiro mark at msapiro.net
Fri Jan 22 19:43:30 EST 2016

Mark Sapiro wrote:

> Actually, further testing of this scenario shows that Mailman is likely
> responsible for the mis-encoding as well.

To summarize and wrap up. It was possible for mailman to create a

From: User_name via list_name <list at example.com>

header with non-ascii in the User_name when creating the new From: for a
message with Munge From or the From: for the outer mwrapper with Wrap
Message. This would occur when the incoming From: had only an address
and no display name so the poster's list membership real name would be
used and that real name contained non-ascii. It could also occur if a
post arrived containing an unencoded display name in From: if the
sending MUA was non-compliant, but this scenario is unlikely.

Thanks to gabriel for reporting the problem so it could ultimately be
found and fixed.

The underlying bug is that Mailman should RFC 2047 encode the User_name
at that point, and now it does (bug at
<https://bugs.launchpad.net/mailman/+bug/1536816>, fix at

This was further exacerbated by the fact that Mailman's SMTPDirect.py
module uses the Mailman Message as_string() method to flatten the
message object to plain text for sending, and sometimes, but not always,
depending on characteristics of the message itself this method would
refold or rewrite certain headers and in so doing would 'see' the
non-ascii in the From: header and RFC 2047 encode the entire header
content without regard for that fact that it contained address specs
that are not to be encoded.

Debugging this issue was complicated by the fact that the header
encoding by as_string() didn't occur with every message and my initial
test messages didn't trigger it.

[1] The only part of the fix at
that is necessary to fix this issue is the addition of

        realname = str(uheader(mlist, realname))

The rest of it is for l10n of the "User_name via list_name" phrase.

Mark Sapiro <mark at msapiro.net>        The highway is for gamblers,
San Francisco Bay Area, California    better use your sense - B. Dylan

More information about the Mailman-Users mailing list