Yahoo's DMARC and Mailman 2.17

I'm afraid I'm not much of a Python programmer so I will post this as a suggestion and hope it's easy enough to do so that someone will pick it up. (Or should I post it to the developers' list? I don't subscribe to it though so I'm not familiar with the culture there.)
I've just upgraded cPanel to take advantage of Mailman 2.1.17's "from_is_list" feature and it works great except for one thing.
If the poster has not filled out the "name" field in his/her MUA (i.e., if the From field says just "email@example.com" instead of "Your Name Here < email@example.com>"), then the munged From field reads "via Listname" instead of "Your Name Here via Listname."
If I'm reading the code right, it looks as if the munging occurs at line 132 of CookHeders.py:
formataddr(('%s via %s' % (realname, mlist.real_name),
I'd like to make a humble feature request as follows:
Check whether the From field has a name and email address or just an email address (i.e., whether "realname" is an empty string).
If it has a name and email address, go ahead and munge it as it is done now: formataddr(('%s via %s' % (realname, mlist.real_name),
If there is only an email address, have it use the email address (or maybe just the local part?) instead: formataddr(('%s via %s' % (email, mlist.real_name),
The "realname" and "email" variables appear to come from line 120: realname, email = parseaddr(msg['from'])
Does that sound reasonable?
This would be useful to me because I'm using Drupal (Mailhandler and Feeds) to archive some lists and I populate the "Submitted by" line with the From field. So whereas it usually says "Submitted by Your Name Here via Listname," it just says "Submitted by via Listname" if the user didn't fill out the MUA's name field.

On 04/23/2014 07:16 PM, Russell Clemings wrote:
If the poster has not filled out the "name" field in his/her MUA (i.e., if the From field says just "email@example.com" instead of "Your Name Here < email@example.com>"), then the munged From field reads "via Listname" instead of "Your Name Here via Listname."
This is <https://bugs.launchpad.net/mailman/+bug/1304511> fixed in 2.1.18rc1. 2.1.18rc2 is released and is better than 2.1.17 for this and <https://bugs.launchpad.net/mailman/+bug/1279667> and a few unrelated bug fixes, but I'm working on another patch for <https://bugs.launchpad.net/mailman/+bug/1311431> and there will shortly be a 2.1.18rc3.
Here's the code in CookHeaders.py. Sorry for the wrapping.
if (msgdata.get('from_is_list') or mlist.from_is_list) and not
fasttrack: realname, email = parseaddr(msg['from']) if not realname: if mlist.isMember(email): realname = mlist.getMemberName(email) or email else: realname = email # Remove domain from realname if it looks like an email address realname = re.sub(r'@([^ .]+\.)+[^ .]+$', '---', realname) change_header('From', formataddr(('%s via %s' % (realname, mlist.real_name), mlist.GetListEmail())),
This takes first, the display name from the From: header. If none and the address is a list member with a real name, use that, and finally fall back to the local part of the email address with 3 dashes appended.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan

I should have known you'd already have caught this. Thanks.
I'll see if I can apply it to 2.1.17 for now. Cpanel hasn't picked up 2.1.18 yet (and in fact still has 2.1.15 in its stable versions).
rac
On Wed, Apr 23, 2014 at 8:08 PM, Mark Sapiro <mark@msapiro.net> wrote:
On 04/23/2014 07:16 PM, Russell Clemings wrote:
If the poster has not filled out the "name" field in his/her MUA (i.e.,
if
the From field says just "email@example.com" instead of "Your Name Here < email@example.com>"), then the munged From field reads "via Listname" instead of "Your Name Here via Listname."
This is <https://bugs.launchpad.net/mailman/+bug/1304511> fixed in 2.1.18rc1. 2.1.18rc2 is released and is better than 2.1.17 for this and <https://bugs.launchpad.net/mailman/+bug/1279667> and a few unrelated bug fixes, but I'm working on another patch for <https://bugs.launchpad.net/mailman/+bug/1311431> and there will shortly be a 2.1.18rc3.
Here's the code in CookHeaders.py. Sorry for the wrapping.
if (msgdata.get('from_is_list') or mlist.from_is_list) and not
fasttrack: realname, email = parseaddr(msg['from']) if not realname: if mlist.isMember(email): realname = mlist.getMemberName(email) or email else: realname = email # Remove domain from realname if it looks like an email address realname = re.sub(r'@([^ .]+\.)+[^ .]+$', '---', realname) change_header('From', formataddr(('%s via %s' % (realname, mlist.real_name), mlist.GetListEmail())),
This takes first, the display name from the From: header. If none and the address is a list member with a real name, use that, and finally fall back to the local part of the email address with 3 dashes appended.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
Mailman-Users mailing list Mailman-Users@python.org https://mail.python.org/mailman/listinfo/mailman-users Mailman FAQ: http://wiki.list.org/x/AgA3 Security Policy: http://wiki.list.org/x/QIA9 Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/ Unsubscribe: https://mail.python.org/mailman/options/mailman-users/rclemings%40gmail.com
participants (2)
-
Mark Sapiro
-
Russell Clemings