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
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.
Subject: Re: [rt.cpan.org #81459] Mail::Address->name is garbled when an email address is used as name
Date: Mon, 26 Nov 2012 11:02:40 +0100
To: Moritz Lenz via RT <bug-MailTools [...] rt.cpan.org>
From: Mark Overmeer <secretaris [...] nluug.nl>
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
Subject: Re: [rt.cpan.org #81459] Mail::Address->name is garbled when an email address is used as name
Date: Mon, 26 Nov 2012 11:10:12 +0100
To: bug-MailTools [...] rt.cpan.org
From: Moritz Lenz <moritz [...] faui2k3.org>
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
Subject: Re: [rt.cpan.org #81459] Mail::Address->name is garbled when an email address is used as name
Date: Mon, 26 Nov 2012 11:27:15 +0100
To: "moritz [...] faui2k3.org via RT" <bug-MailTools [...] rt.cpan.org>
From: Mark Overmeer <secretaris [...] nluug.nl>
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
Subject: Re: [rt.cpan.org #81459] Mail::Address->name is garbled when an email address is used as name
Date: Mon, 26 Nov 2012 12:01:32 +0100
To: bug-MailTools [...] rt.cpan.org
From: Moritz Lenz <moritz [...] faui2k3.org>
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
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.