Skip Menu |
 

This queue is for tickets about the MailTools CPAN distribution.

Report information
The Basics
Id: 81459
Status: resolved
Priority: 0/
Queue: MailTools

People
Owner: Nobody in particular
Requestors: MORITZ [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 2.11
Fixed in: (no value)



Subject: Mail::Address->name is garbled when an email address is used as name
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 365
Download (untitled) / with headers
text/plain 365b
mlenz@otrs6:~/MailTools-2.11$ perl -Ilib -wE 'use Mail::Address; for my $s (Mail::Address->parse(q[root@mx03.noris.net <root@mx03.noris.net>])) { say $s->name }' Root @ Mx03 . Noris . Net I'd argue that it would be much better to use the email address verbatim as the name. Capitalizing and adding spaces does not add any value, but reduces reability in this case.
From markov [...] overmeer.net Mon Nov 26 05: 02:58 2012
MIME-Version: 1.0
X-Spam-Status: No, score=-5.554 tagged_above=-99.9 required=10 tests=[AWL=1.346, BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5] autolearn=ham
In-Reply-To: <rt-3.8.HEAD-21537-1353923556-392.81459-4-0 [...] rt.cpan.org>
Content-Disposition: inline
X-Spam-Flag: NO
References: <RT-Ticket-81459 [...] rt.cpan.org> <rt-3.8.HEAD-21537-1353923556-392.81459-4-0 [...] rt.cpan.org>
X-Virus-Scanned: Debian amavisd-new at bestpractical.com
Message-ID: <20121126100240.GU3400 [...] moon.overmeer.net>
Content-Type: text/plain; charset="utf-8"
X-RT-Original-Encoding: utf-8
X-Spam-Score: -5.554
Received: from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id B0337240A16 for <cpan-bug+mailtools [...] hipster.bestpractical.com>; Mon, 26 Nov 2012 05:02:58 -0500 (EST)
Received: from hipster.bestpractical.com ([127.0.0.1]) by localhost (hipster.bestpractical.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fOcV+nJvzua8 for <cpan-bug+mailtools [...] hipster.bestpractical.com>; Mon, 26 Nov 2012 05:02:55 -0500 (EST)
Received: from la.mx.develooper.com (x1.develooper.com [207.171.7.70]) by hipster.bestpractical.com (Postfix) with SMTP id A31682408FA for <bug-mailtools [...] rt.cpan.org>; Mon, 26 Nov 2012 05:02:55 -0500 (EST)
Received: (qmail 6695 invoked by uid 103); 26 Nov 2012 10:02:54 -0000
Received: from x16.dev (10.0.100.26) by x1.dev with QMQP; 26 Nov 2012 10:02:54 -0000
Received: from fep20.mx.upcmail.net (HELO fep20.mx.upcmail.net) (62.179.121.40) by 16.mx.develooper.com (qpsmtpd/0.84/v0.84-167-g4ed6cab) with ESMTP; Mon, 26 Nov 2012 02:02:48 -0800
Received: from edge02.upcmail.net ([192.168.13.237]) by viefep20-int.chello.at (InterMail vM.8.01.05.05 201-2260-151-110-20120111) with ESMTP id <20121126100242.WBNY26345.viefep20-int.chello.at [...] edge02.upcmail.net> for <bug-mailtools [...] rt.cpan.org>; Mon, 26 Nov 2012 11:02:42 +0100
Received: from moon.overmeer.net ([178.84.121.203]) by edge02.upcmail.net with edge id UA2h1k01J4PQHKm02A2hB5; Mon, 26 Nov 2012 11:02:42 +0100
Received: by moon.overmeer.net (Postfix, from userid 1000) id 1029F47B3; Mon, 26 Nov 2012 11:02:41 +0100 (CET)
Delivered-To: cpan-bug+mailtools [...] hipster.bestpractical.com
Subject: Re: [rt.cpan.org #81459] Mail::Address->name is garbled when an email address is used as name
User-Agent: Mutt/1.5.21 (2010-09-15)
Return-Path: <markov [...] overmeer.net>
X-Spam-Check-BY: 16.mx.develooper.com
X-Original-To: cpan-bug+mailtools [...] hipster.bestpractical.com
X-RT-Mail-Extension: mailtools
Date: Mon, 26 Nov 2012 11:02:40 +0100
X-Sourceip: 178.84.121.203
X-Spam-Level:
To: Moritz Lenz via RT <bug-MailTools [...] rt.cpan.org>
From: Mark Overmeer <secretaris [...] nluug.nl>
RT-Message-ID: <rt-3.8.HEAD-21537-1353924179-1814.81459-0-0 [...] rt.cpan.org>
Content-Length: 1567
Download (untitled) / with headers
text/plain 1.5k
* Moritz Lenz via RT (bug-MailTools@rt.cpan.org) [121126 09:52]: Show quoted text
> Mon Nov 26 04:52:36 2012: Request 81459 was acted upon. > Transaction: Ticket created by MORITZ > Queue: MailTools > Subject: Mail::Address->name is garbled when an email address is used as name > Broken in: 2.11 > Severity: (no value) > Owner: Nobody > Requestors: MORITZ@cpan.org > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=81459 > > > mlenz@otrs6:~/MailTools-2.11$ perl -Ilib -wE 'use Mail::Address; for my > $s (Mail::Address->parse(q[root@mx03.noris.net <root@mx03.noris.net>])) > { say $s->name }' > Root @ Mx03 . Noris . Net > > I'd argue that it would be much better to use the email address verbatim > as the name. Capitalizing and adding spaces does not add any value, but > reduces reability in this case.
Hi Moritz, True. But the whole concept is broken... MailTools tries to be smart, improving the "phrase" into a real personal name. However, there (probably) is a reason why the owner wants his/her name to be presented that way. Use $address->phrase, forget about $address->name It is only there for backwards compatibility. I have included a "note" about this for the next release. -- Regards, MarkOv ------------------------------------------------------------------------ Mark Overmeer MSc MARKOV Solutions Mark@Overmeer.net solutions@overmeer.net http://Mark.Overmeer.net http://solutions.overmeer.net
From moritz [...] faui2k3.org Mon Nov 26 05: 10:28 2012
X-Sa-Exim-Connect-Ip: 2001:780:0:b:4479:be22:32ae:d4f8
MIME-Version: 1.0
X-Spam-Status: No, score=-6.899 tagged_above=-99.9 required=10 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, SPF_FAIL=0.001] autolearn=ham
In-Reply-To: <rt-3.8.HEAD-21537-1353924179-1074.81459-6-0 [...] rt.cpan.org>
X-Spam-Flag: NO
X-Sa-Exim-Version: 4.2.1 (built Mon, 22 Mar 2010 06:26:47 +0000)
References: <RT-Ticket-81459 [...] rt.cpan.org> <rt-3.8.HEAD-21537-1353923556-392.81459-4-0 [...] rt.cpan.org> <20121126100240.GU3400 [...] moon.overmeer.net> <rt-3.8.HEAD-21537-1353924179-1074.81459-6-0 [...] rt.cpan.org>
X-Virus-Scanned: Debian amavisd-new at bestpractical.com
Message-ID: <50B34004.2050204 [...] faui2k3.org>
Content-Type: text/plain; charset=UTF-8; format=flowed
X-RT-Original-Encoding: utf-8
X-Spam-Score: -6.899
Received: from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id D07D2240A16 for <cpan-bug+MailTools [...] hipster.bestpractical.com>; Mon, 26 Nov 2012 05:10:28 -0500 (EST)
Received: from hipster.bestpractical.com ([127.0.0.1]) by localhost (hipster.bestpractical.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xve2XkU1mT-r for <cpan-bug+MailTools [...] hipster.bestpractical.com>; Mon, 26 Nov 2012 05:10:27 -0500 (EST)
Received: from la.mx.develooper.com (x1.develooper.com [207.171.7.70]) by hipster.bestpractical.com (Postfix) with SMTP id C18F92408FA for <bug-MailTools [...] rt.cpan.org>; Mon, 26 Nov 2012 05:10:26 -0500 (EST)
Received: (qmail 7477 invoked by uid 103); 26 Nov 2012 10:10:25 -0000
Received: from x16.dev (10.0.100.26) by x1.dev with QMQP; 26 Nov 2012 10:10:25 -0000
Received: from faui2k3.org (HELO casella.faui2k3.org) (213.95.10.24) by 16.mx.develooper.com (qpsmtpd/0.84/v0.84-167-g4ed6cab) with ESMTP; Mon, 26 Nov 2012 02:10:18 -0800
Received: from [2001:780:0:b:4479:be22:32ae:d4f8] by casella.faui2k3.org with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.72) (envelope-from <moritz [...] faui2k3.org>) id 1Tcvdl-0008TS-Mq for bug-MailTools [...] rt.cpan.org; Mon, 26 Nov 2012 11:10:15 +0100
Delivered-To: cpan-bug+MailTools [...] hipster.bestpractical.com
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121028 Thunderbird/16.0.2
X-Sa-Exim-Mail-From: moritz [...] faui2k3.org
Subject: Re: [rt.cpan.org #81459] Mail::Address->name is garbled when an email address is used as name
Return-Path: <moritz [...] faui2k3.org>
X-Spam-Check-BY: 16.mx.develooper.com
X-Original-To: cpan-bug+MailTools [...] hipster.bestpractical.com
X-RT-Mail-Extension: mailtools
X-Old-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.3.1
Date: Mon, 26 Nov 2012 11:10:12 +0100
X-Sa-Exim-Scanned: Yes (on casella.faui2k3.org)
X-Old-Spam-Level:
X-Spam-Level:
To: bug-MailTools [...] rt.cpan.org
Content-Transfer-Encoding: 7bit
From: Moritz Lenz <moritz [...] faui2k3.org>
RT-Message-ID: <rt-3.8.HEAD-21537-1353924629-870.81459-0-0 [...] rt.cpan.org>
Content-Length: 1151
Download (untitled) / with headers
text/plain 1.1k
On 11/26/2012 11:03 AM, Mark Overmeer via RT wrote: Show quoted text
>> mlenz@otrs6:~/MailTools-2.11$ perl -Ilib -wE 'use Mail::Address; for my >> $s (Mail::Address->parse(q[root@mx03.noris.net <root@mx03.noris.net>])) >> { say $s->name }' >> Root @ Mx03 . Noris . Net >> >> I'd argue that it would be much better to use the email address verbatim >> as the name. Capitalizing and adding spaces does not add any value, but >> reduces reability in this case.
> > Hi Moritz, > > True. But the whole concept is broken... MailTools tries to be > smart, improving the "phrase" into a real personal name. However, > there (probably) is a reason why the owner wants his/her name to > be presented that way. > > Use $address->phrase, forget about $address->name It is only there > for backwards compatibility. I have included a "note" about this for > the next release.
Unfortunately $address->phrase also contains only the (partially) mangled sender name: $ perl -Ilib -wE 'use Mail::Address; for my $s (Mail::Address->parse(q[root@mx03.noris.net <root@mx03.noris.net>])) { say $s->phrase }' root @ mx03 . noris . net IMHO that's still too smart. Cheers, Moritz
From markov [...] overmeer.net Mon Nov 26 05: 27:32 2012
MIME-Version: 1.0
X-Spam-Status: No, score=-5.604 tagged_above=-99.9 required=10 tests=[AWL=1.296, BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5] autolearn=ham
In-Reply-To: <rt-3.8.HEAD-21537-1353924629-1220.81459-5-0 [...] rt.cpan.org>
Content-Disposition: inline
X-Spam-Flag: NO
References: <RT-Ticket-81459 [...] rt.cpan.org> <rt-3.8.HEAD-21537-1353923556-392.81459-4-0 [...] rt.cpan.org> <20121126100240.GU3400 [...] moon.overmeer.net> <rt-3.8.HEAD-21537-1353924179-1074.81459-6-0 [...] rt.cpan.org> <50B34004.2050204 [...] faui2k3.org> <rt-3.8.HEAD-21537-1353924629-1220.81459-5-0 [...] rt.cpan.org>
X-Virus-Scanned: Debian amavisd-new at bestpractical.com
Message-ID: <20121126102715.GV3400 [...] moon.overmeer.net>
Content-Type: text/plain; charset="utf-8"
X-RT-Original-Encoding: utf-8
X-Spam-Score: -5.604
Received: from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id 240CC2408FA for <cpan-bug+mailtools [...] hipster.bestpractical.com>; Mon, 26 Nov 2012 05:27:32 -0500 (EST)
Received: from hipster.bestpractical.com ([127.0.0.1]) by localhost (hipster.bestpractical.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id AnsqSjYWKXLo for <cpan-bug+mailtools [...] hipster.bestpractical.com>; Mon, 26 Nov 2012 05:27:30 -0500 (EST)
Received: from la.mx.develooper.com (x1.develooper.com [207.171.7.70]) by hipster.bestpractical.com (Postfix) with SMTP id F2BDA240245 for <bug-mailtools [...] rt.cpan.org>; Mon, 26 Nov 2012 05:27:29 -0500 (EST)
Received: (qmail 9016 invoked by uid 103); 26 Nov 2012 10:27:29 -0000
Received: from x16.dev (10.0.100.26) by x1.dev with QMQP; 26 Nov 2012 10:27:29 -0000
Received: from fep13.mx.upcmail.net (HELO fep13.mx.upcmail.net) (62.179.121.33) by 16.mx.develooper.com (qpsmtpd/0.84/v0.84-167-g4ed6cab) with ESMTP; Mon, 26 Nov 2012 02:27:25 -0800
Received: from edge01.upcmail.net ([192.168.13.236]) by viefep13-int.chello.at (InterMail vM.8.01.05.05 201-2260-151-110-20120111) with ESMTP id <20121126102718.DHHR3518.viefep13-int.chello.at [...] edge01.upcmail.net> for <bug-mailtools [...] rt.cpan.org>; Mon, 26 Nov 2012 11:27:18 +0100
Received: from moon.overmeer.net ([178.84.121.203]) by edge01.upcmail.net with edge id UATF1k01e4PQHKm01ATFHh; Mon, 26 Nov 2012 11:27:18 +0100
Received: by moon.overmeer.net (Postfix, from userid 1000) id 9011B47CB; Mon, 26 Nov 2012 11:27:15 +0100 (CET)
Delivered-To: cpan-bug+mailtools [...] hipster.bestpractical.com
Subject: Re: [rt.cpan.org #81459] Mail::Address->name is garbled when an email address is used as name
User-Agent: Mutt/1.5.21 (2010-09-15)
Return-Path: <markov [...] overmeer.net>
X-Spam-Check-BY: 16.mx.develooper.com
X-Original-To: cpan-bug+mailtools [...] hipster.bestpractical.com
X-RT-Mail-Extension: mailtools
Date: Mon, 26 Nov 2012 11:27:15 +0100
X-Sourceip: 178.84.121.203
X-Spam-Level:
To: "moritz [...] faui2k3.org via RT" <bug-MailTools [...] rt.cpan.org>
From: Mark Overmeer <secretaris [...] nluug.nl>
RT-Message-ID: <rt-3.8.HEAD-14308-1353925652-1329.81459-0-0 [...] rt.cpan.org>
Content-Length: 1463
Download (untitled) / with headers
text/plain 1.4k
* moritz@faui2k3.org via RT (bug-MailTools@rt.cpan.org) [121126 10:10]: Show quoted text
> Queue: MailTools > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=81459 > > > Unfortunately $address->phrase also contains only the (partially) > mangled sender name:
I was not aware of that. I always use Mail::Box::Field::Address ;-) (This is all very old code by Graham Barr, only syntactically cleaned-up by me later) Show quoted text
> $ perl -Ilib -wE 'use Mail::Address; for my $s > (Mail::Address->parse(q[root@mx03.noris.net <root@mx03.noris.net>])) { > say $s->phrase }' > root @ mx03 . noris . net > > IMHO that's still too smart.
As far as I can see, the problem is in line 97 if( s/^("(?:[^"\\]+|\\.)*")\s*// # "..." || s/^(\[(?:[^\]\\]+|\\.)*\])\s*// # [...] || s/^([^\s()<>\@,;:\\".[\]]+)\s*// <--- || s/^([()<>\@,;:\\".[\]])\s*// ) The whole tokenizer is not sufficiently according to spec (the Mail::Box address parser is, but probably considerably slower) Should we remove '.' from that regex? Would it break things? At least, it does break a regression test. -- Regards, MarkOv ------------------------------------------------------------------------ Mark Overmeer MSc MARKOV Solutions Mark@Overmeer.net solutions@overmeer.net http://Mark.Overmeer.net http://solutions.overmeer.net
From moritz [...] faui2k3.org Mon Nov 26 06: 01:47 2012
X-Sa-Exim-Connect-Ip: 2001:780:0:b:4479:be22:32ae:d4f8
MIME-Version: 1.0
X-Spam-Status: No, score=-6.899 tagged_above=-99.9 required=10 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, SPF_FAIL=0.001] autolearn=ham
In-Reply-To: <rt-3.8.HEAD-14308-1353925653-501.81459-6-0 [...] rt.cpan.org>
X-Spam-Flag: NO
X-Sa-Exim-Version: 4.2.1 (built Mon, 22 Mar 2010 06:26:47 +0000)
References: <RT-Ticket-81459 [...] rt.cpan.org> <rt-3.8.HEAD-21537-1353923556-392.81459-4-0 [...] rt.cpan.org> <20121126100240.GU3400 [...] moon.overmeer.net> <rt-3.8.HEAD-21537-1353924179-1074.81459-6-0 [...] rt.cpan.org> <50B34004.2050204 [...] faui2k3.org> <rt-3.8.HEAD-21537-1353924629-1220.81459-5-0 [...] rt.cpan.org> <20121126102715.GV3400 [...] moon.overmeer.net> <rt-3.8.HEAD-14308-1353925653-501.81459-6-0 [...] rt.cpan.org>
X-Virus-Scanned: Debian amavisd-new at bestpractical.com
Message-ID: <50B34C0C.7090504 [...] faui2k3.org>
Content-Type: text/plain; charset=UTF-8; format=flowed
X-RT-Original-Encoding: utf-8
X-Spam-Score: -6.899
Received: from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id 515162408FA for <cpan-bug+MailTools [...] hipster.bestpractical.com>; Mon, 26 Nov 2012 06:01:47 -0500 (EST)
Received: from hipster.bestpractical.com ([127.0.0.1]) by localhost (hipster.bestpractical.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6L+1c720oqYo for <cpan-bug+MailTools [...] hipster.bestpractical.com>; Mon, 26 Nov 2012 06:01:46 -0500 (EST)
Received: from la.mx.develooper.com (x1.develooper.com [207.171.7.70]) by hipster.bestpractical.com (Postfix) with SMTP id 2F32D240A16 for <bug-MailTools [...] rt.cpan.org>; Mon, 26 Nov 2012 06:01:41 -0500 (EST)
Received: (qmail 12169 invoked by uid 103); 26 Nov 2012 11:01:40 -0000
Received: from x16.dev (10.0.100.26) by x1.dev with QMQP; 26 Nov 2012 11:01:40 -0000
Received: from faui2k3.org (HELO casella.faui2k3.org) (213.95.10.24) by 16.mx.develooper.com (qpsmtpd/0.84/v0.84-167-g4ed6cab) with ESMTP; Mon, 26 Nov 2012 03:01:38 -0800
Received: from [2001:780:0:b:4479:be22:32ae:d4f8] by casella.faui2k3.org with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.72) (envelope-from <moritz [...] faui2k3.org>) id 1TcwRR-0000th-QI for bug-MailTools [...] rt.cpan.org; Mon, 26 Nov 2012 12:01:34 +0100
Delivered-To: cpan-bug+MailTools [...] hipster.bestpractical.com
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121028 Thunderbird/16.0.2
X-Sa-Exim-Mail-From: moritz [...] faui2k3.org
Subject: Re: [rt.cpan.org #81459] Mail::Address->name is garbled when an email address is used as name
Return-Path: <moritz [...] faui2k3.org>
X-Spam-Check-BY: 16.mx.develooper.com
X-Original-To: cpan-bug+MailTools [...] hipster.bestpractical.com
X-RT-Mail-Extension: mailtools
X-Old-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.3.1
Date: Mon, 26 Nov 2012 12:01:32 +0100
X-Sa-Exim-Scanned: Yes (on casella.faui2k3.org)
X-Old-Spam-Level:
X-Spam-Level:
To: bug-MailTools [...] rt.cpan.org
Content-Transfer-Encoding: 7bit
From: Moritz Lenz <moritz [...] faui2k3.org>
RT-Message-ID: <rt-3.8.HEAD-14308-1353927708-710.81459-0-0 [...] rt.cpan.org>
Content-Length: 1159
Download (untitled) / with headers
text/plain 1.1k
On 11/26/2012 11:27 AM, Mark Overmeer via RT wrote: Show quoted text
>> $ perl -Ilib -wE 'use Mail::Address; for my $s >> (Mail::Address->parse(q[root@mx03.noris.net <root@mx03.noris.net>])) { >> say $s->phrase }' >> root @ mx03 . noris . net >> >> IMHO that's still too smart.
> > As far as I can see, the problem is in line 97 > > if( s/^("(?:[^"\\]+|\\.)*")\s*// # "..." > || s/^(\[(?:[^\]\\]+|\\.)*\])\s*// # [...] > || s/^([^\s()<>\@,;:\\".[\]]+)\s*// <--- > || s/^([()<>\@,;:\\".[\]])\s*// > ) > > The whole tokenizer is not sufficiently according to spec (the Mail::Box > address parser is, but probably considerably slower) > > Should we remove '.' from that regex? Would it break things? At least, > it does break a regression test.
For my purpose, the \@ must also be removed. And yes, it breaks a regression test, but IMHO that one is much more obscure than my use case :-) (of course, since it's my use case; but judge for yourself). But I can't really comment on how it effects the overall parser, I'm neither very familiar with the code nor with the relevant RFCs. Cheers, Moritz
MIME-Version: 1.0
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline
Content-Type: text/plain; charset="UTF-8"
Message-ID: <rt-3.8.HEAD-20243-1358501141-1601.81459-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 103
Download (untitled) / with headers
text/plain 103b
Resulted in a warning in the docs for version 2.2, not changed to maintain backwards (broken) behavior.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.