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

Mark Sapiro mark at msapiro.net
Thu Jan 21 17:37:12 EST 2016


On 01/21/2016 10:15 AM, Mark Sapiro wrote:
> 
> Here's what I think is happening.
> 
> Mailman is munging the From: header from
> 
> From: valerie at mydomain.org
> 
> to
> 
> From: valérie via List <list at example.com>
> 
> where valérie comes from the member's name field in the list membership.
> This is done to try to identify the member without actually including an
> email address in the display name as that is said to be a red flag to
> some ISPs.
> 
> Mailman should really RFC 2047 encode the resultant display name or at
> least the non-ascii part of it, but it doesn't. I accept this as a
> Mailman bug and will work on fixing it.
> 
> Anyway, Mailman sends the message with that non-ascii From: header and
> the outgoing MTA attempts to fix it and in the process makes it even worse.


Actually, further testing of this scenario shows that Mailman is likely
responsible for the mis-encoding as well. Once I realized the key was in
providing the poster's real name from the list's membership, I was able
to duplicate the issue including the mis-encoding.

So I don't need to see any further samples, and I have developed a fix.
The basic fix is very simple. In Mailman/Handlers/Cookheaders.py around
line 155 are the lines:

        change_header('From',
                      formataddr(('%s via %s' % (realname, mlist.real_name),
                                  mlist.GetListEmail())),
                       mlist, msg, msgdata)

Immediately before the change_header insert (indented the same 8 spaces)

        realname = str(uheader(mlist, realname))

which will RFC 2047 encode the realname if it contains non-ascii.

This is now reported as
<https://bugs.launchpad.net/mailman/+bug/1536816> and the fix will be
committed soon.

-- 
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