Skip Menu |

This queue is for tickets about the Mail-Box CPAN distribution.

Report information
The Basics
Id: 55309
Status: resolved
Priority: 0/
Queue: Mail-Box

People
Owner: Nobody in particular
Requestors: dds [...] aueb.gr
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 2.093
Fixed in: (no value)



Subject: Incorrect parsing of encoded split addresses
An encoded address split into multiple lines e.g. To: =?ISO-8859-7?Q?=CB=C1=C6=C1=D1=C9=C4=C7=D9=D4?= =?ISO-8859-7?Q?=C7=D3?= <p.lazaridis@example.com> results in a truncated Mail::Message::Field::Address. How to replicate: perl debug-parse-mail.pl <split-to.eml $full is a Mail::Message::Field::Addresses nrLines=2 Name=To decodedBody=ΛΑΖΑΡΙΔΗΣ ΠΑΝΑΓΙΩΤΗΣ <p.lazaridis@example.com> $a is a Mail::Message::Field::Address To Address=p.lazaridis@example.com To Name (encoded)==?ISO-8859-7?Q?=C7=D3?= To Phrase (encoded)==?ISO-8859-7?Q?=C7=D3?= To Name=ΗΣ Expacted output: perl debug-parse-mail.pl <split-to.eml $full is a Mail::Message::Field::Addresses nrLines=2 Name=To decodedBody=ΛΑΖΑΡΙΔΗΣ ΠΑΝΑΓΙΩΤΗΣ <p.lazaridis@example.com> $a is a Mail::Message::Field::Address To Address=p.lazaridis@example.com To Name (encoded)==?ISO-8859-7?Q?=C7=D3?= To Phrase (encoded)==?ISO-8859-7?Q?=C7=D3?= To Name=ΛΑΖΑΡΙΔΗΣ ΠΑΝΑΓΙΩΤΗΣ Operating environment: FreeBSD 6.4-STABLE FreeBSD 6.4-STABLE #15: Thu Feb 4 17:32:46 EET 2010 This is perl, v5.8.9 built for i386-freebsd-64int (with 1 registered patch, see perl -V for more detail) p5-Mail-Box-2.093_1
Subject: debug-parse-mail.pl
#!/usr/bin/perl use utf8; use Mail::Message; binmode STDOUT, ":utf8"; $msg = Mail::Message->read(\*STDIN); my $full = $msg->head->study('to'); print "\$full is a ", ref($full), "\n"; print "nrLines=", $full->nrLines, "\n"; print "Name=", $full->Name, "\n"; print "decodedBody=", $full->decodedBody, "\n"; my @to = $full->addresses; for my $a (@to) { print "\$a is a ", ref($a), "\n"; print "To Address=", $a->address, "\n"; print "To Name (encoded)=", $a->name, "\n"; print "To Phrase (encoded)=", $a->phrase, "\n"; my $name = Mail::Message::Field::Full->decode($a->name); print "To Name=$name\n"; }
Subject: split-to.eml
Download split-to.eml
message/rfc822 376b
Message-ID: <4B4EE288.8070409@aueb.gr> Date: Thu, 14 Jan 2010 11:23:20 +0200 From: Diomidis Spinellis <dds@example.com> User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) MIME-Version: 1.0 To: =?ISO-8859-7?Q?=CB=C1=C6=C1=D1=C9=C4=C7=D3_=D0=C1=CD=C1=C3=C9=D9=D4?= =?ISO-8859-7?Q?=C7=D3?= <p.lazaridis@example.com> Subject: Any subject Content-Type: text/plain Hi
Subject: Re: [rt.cpan.org #55309] Incorrect parsing of encoded split addresses
Date: Sun, 7 Mar 2010 22:27:40 +0100
To: "http://www.spinellis.gr/blog/ via RT" <bug-Mail-Box [...] rt.cpan.org>
From: Mark Overmeer <mark [...] overmeer.net>
* http://www.spinellis.gr/blog/ via RT (bug-Mail-Box@rt.cpan.org) [100307 09:37]: Show quoted text
> Sun Mar 07 04:37:43 2010: Request 55309 was acted upon. > Transaction: Ticket created by http://www.spinellis.gr/blog/ > Queue: Mail-Box > Subject: Incorrect parsing of encoded split addresses > Broken in: 2.093 > Severity: Important > Owner: Nobody > Requestors: dds@aueb.gr > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=55309 > > > An encoded address split into multiple lines e.g. > To: =?ISO-8859-7?Q?=CB=C1=C6=C1=D1=C9=C4=C7=D9=D4?= > =?ISO-8859-7?Q?=C7=D3?= <p.lazaridis@example.com>
Add to Mail/Message/Field/Addresses.pm: sub parse($) { my ($self, $string) = @_; my ($group, $email) = ('', undef); + $string =~ s/\s+/ /gs; -- Thanks for the report, 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 #55309] Incorrect parsing of encoded split addresses
Date: Mon, 08 Mar 2010 00:20:58 +0200
To: bug-Mail-Box [...] rt.cpan.org
From: Diomidis Spinellis <dds [...] aueb.gr>
Mark Overmeer via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=55309 > > > * http://www.spinellis.gr/blog/ via RT (bug-Mail-Box@rt.cpan.org) [100307 09:37]:
>> Sun Mar 07 04:37:43 2010: Request 55309 was acted upon. >> Transaction: Ticket created by http://www.spinellis.gr/blog/ >> Queue: Mail-Box >> Subject: Incorrect parsing of encoded split addresses >> Broken in: 2.093 >> Severity: Important >> Owner: Nobody >> Requestors: dds@aueb.gr >> Status: new >> Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=55309 > >> >> An encoded address split into multiple lines e.g. >> To: =?ISO-8859-7?Q?=CB=C1=C6=C1=D1=C9=C4=C7=D9=D4?= >> =?ISO-8859-7?Q?=C7=D3?= <p.lazaridis@example.com>
> > Add to Mail/Message/Field/Addresses.pm: > > sub parse($) > { my ($self, $string) = @_; > my ($group, $email) = ('', undef); > + $string =~ s/\s+/ /gs; >
Works like a charm - thank you for the amazingly fast response! Diomidis PS Although I'm a Perl fan since 1989, I looked at mail handling of a number of languages, before I chose Perl and MailBox for the application I'm writing. All the libraries I examined (IIRC those of PHP, Python, and, maybe, Java) were a joke compared to your work. Bravo!
got fixed in 2.094