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