Subject: | MailInternet->export() can't export multiline headers |
test.pl :
#!/usr/bin/perl -w
use strict;
use Mail::Box::Manager;
use Mail::Message::Convert::MailInternet;
my $filename='lm';
my $mgr = Mail::Box::Manager->new;
my $folder=$mgr->open(folder => $filename);
my $message=$folder->message(0);
my $convert = Mail::Message::Convert::MailInternet->new(fields => '');
my $mail=$convert->export($message, Modify => 0);
$mail->print;
$folder->close;
lm is an mbox containing one mail.
running test.pl gives :
$ test.pl
Argument "^Iby orcal.delepine.info (Postfix) with ESMTP id 1E8231B..." isn't
+numeric in numeric lt (<) at /usr/share/perl5/Mail/Header.pm line 237, <GEN2>
+line 36.
Argument "^Iby jeancharles.delepine.info (8.12.8/8.12.8/Debian-2) ..." isn't
+numeric in numeric lt (<) at /usr/share/perl5/Mail/Header.pm line 237, <GEN2>
+line 36.
Argument "^Iby gip.u-picardie.fr (Postfix) with ESMTP id 4919D7E7D..." isn't
+numeric in numeric lt (<) at /usr/share/perl5/Mail/Header.pm line 237, <GEN2>
+line 36.
Argument "^Iid 3B682FF9C; Fri, 14 Mar 2003 12:25:35 +0100 (CET)\n" isn't numeric
+in numeric lt (<) at /usr/share/perl5/Mail/Header.pm line 237, <GEN2> line 36.
Received: by duvel.u-picardie.Fr (Postfix, from userid 1000)
Received: from duvel.u-picardie.Fr (duvel.u-picardie.fr [193.49.184.12])
Received: from gip.u-picardie.fr (gip.u-picardie.fr [193.49.184.17])
Received: from jeancharles.delepine.info (eloi.machoro.ka [10.1.44.1])
User-Agent: Mutt/1.3.28i
Return-Path: <delepine at u-picardie.fr>
X-Original-To: lm at moderos.fr.eu.org
Status: RO
Date: Fri, 14 Mar 2003 12:25:35 +0100
Lines: 3
Content-Type: text/plain; charset=iso-8859-1
To: lm at moderos.fr.eu.org
X-Organization: Jack Daniel - Canal Habituel
Mime-Version: 1.0
From: Jean Charles Delepine <delepine at u-picardie.fr>
Delivered-To: modapp at delepine.info
Content-Disposition: inline
Subject: test
Content-Length: 81
Content-Transfer-Encoding: 8bit
Newsgroups: local.moderated
Message-ID: <20030314112535.GH10566 at u-picardie.fr>
test
With the attached patch test.pl gives :
$ test.pl
Return-Path: <delepine at u-picardie.fr>
X-Original-To: lm at moderos.fr.eu.org
Delivered-To: modapp at delepine.info
Received: from jeancharles.delepine.info (eloi.machoro.ka [10.1.44.1])
by orcal.delepine.info (Postfix) with ESMTP id 1E8231B600
for <lm at moderos.fr.eu.org>; Fri, 14 Mar 2003 12:25:35 +0100 (CET)
Received: from gip.u-picardie.fr (gip.u-picardie.fr [193.49.184.17])
by jeancharles.delepine.info (8.12.8/8.12.8/Debian-2) with ESMTP id
+h2EBPZ7F018755
for <lm at moderos.fr.eu.org>; Fri, 14 Mar 2003 12:25:35 +0100
Received: from duvel.u-picardie.Fr (duvel.u-picardie.fr [193.49.184.12])
by gip.u-picardie.fr (Postfix) with ESMTP id 4919D7E7D
for <lm at moderos.fr.eu.org>; Fri, 14 Mar 2003 12:25:35 +0100 (CET)
Received: by duvel.u-picardie.Fr (Postfix, from userid 1000)
id 3B682FF9C; Fri, 14 Mar 2003 12:25:35 +0100 (CET)
Date: Fri, 14 Mar 2003 12:25:35 +0100
From: Jean Charles Delepine <delepine at u-picardie.fr>
To: lm at moderos.fr.eu.org
Subject: test
Message-ID: <20030314112535.GH10566 at u-picardie.fr>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
User-Agent: Mutt/1.3.28i
X-Organization: Jack Daniel - Canal Habituel
Newsgroups: local.moderated
Status: RO
Content-Length: 81
Lines: 3
test
-- System Information
Debian Release: 3.0
Architecture: i386
Kernel: Linux orcal 2.4.20-pre7-ac1 #3 Sat Sep 21 01:56:17 CEST 2002 i686
Locale: LANG=fr_FR, LC_CTYPE=fr_FR
Versions of packages libmail-box-perl depends on:
ii libio-stringy-perl 2.108-1 Perl5 modules for IO from scalars
ii libmailtools-perl 1.44-1 Manipulate email in perl programs
ii libmime-types-perl 1.005-1 Perl extension for determining MIM
ii libobject-realize-later-perl 0.10-1 Delayed creation of objects
ii libscalar-list-utils-perl 1.0701-1 A selection of general-utility lis
ii libtimedate-perl 1.11-1 Time and date functions for perl.
ii perl 5.8.0-15 Larry Wall's Practical Extraction
--- /usr/share/perl5/Mail/Message/Convert/MailInternet.pm Wed Mar 5 15:41:19 2003
+++ MailInternet.pm Sat Mar 15 13:52:23 2003
@@ -22,9 +22,8 @@
my $mi_head = Mail::Header->new;
my $head = $message->head;
- foreach my $name ($head->names)
- { $mi_head->add(undef, $_->string)
- foreach $head->get($name);
+ foreach my $field ($head->orderedFields)
+ { $mi_head->add($field->Name, scalar $field->foldedBody);
}
Mail::Internet->new