Re: Writing the 'From ' line
Bill Moseley <[email protected]>
| Newsgroups | gmane.comp.lang.perl.modules.mail-box |
|---|---|
| Message-ID | <[email protected]> |
On Sun, Jan 18, 2004 at 08:46:23AM +0100, Mark Overmeer wrote: > * Bill Moseley ([email protected]) [040118 01:41]: > > My goal is to get a mbox file with the messages sorted by > > $msg->timestamp. > > > > I'm reading message from one mailbox, sorting by $msg->timestamp, and > > adding the messages to an outbox with: > > > > $outbox->addMessage( $message ); > > > > But the resulting mbox file is not is the same order as I add the > > messages. > > Mail::Box is *not* changing the order of the messages, so this cannot > be true. Oh, sure, Mark. Admit it, you hacked my machine and fixed it while I was sleeping. Yes, seems to sort correctly -- not sure what I was seeing yesterday, but I did spend a bit of time trying to "fix" it. Oh well. I do have a question about $msg->timestamp. I've got a message where it looks like the 'From ' and Received: dates match, but their Date: header is wrong, and $msg->timestamp is reading the Date: header: moseley@bumby:~/hyper$ cat test3 From [email protected] Sun May 10 22:57:21 1998 Received: from mail.ricsson.com ([202.96.166.214]) by sunsite.Berkeley.EDU (8.9.0.Beta5/8.9.0.Beta5) with SMTP id WAA28188 for <[email protected]>; Sun, 10 May 1998 22:57:13 -0700 (PDT) Received: from tonnytam (dns2.ricsson.com [202.96.166.212]) by mail.ricsson.com (950413.SGI.8.6.12/950213.SGI.AUTOCF) Message-ID: <[email protected]> Date: Sat, 11 May 1996 14:00:07 -0700 From: "[email protected]" <[email protected]> Reply-To: [email protected] Organization: [email protected] X-Mailer: Mozilla 3.01Gold (WinNT; I) MIME-Version: 1.0 To: [email protected] Subject: Can I use swish-e to index a chinese web site? Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hello: as subject,can i use swish-e to index a chinese web site and+ use a chinese as keyword to search it? Help me! thank you! Tonny Tam moseley@bumby:~/hyper$ cat t.pl use Mail::Box::Manager; my $box = Mail::Box::Manager->new->open('test3') || die $!; my @messages = $box->messages; print scalar localtime $messages[0]->timestamp; print scalar localtime $messages[0]->guessTimestamp; moseley@bumby:~/hyper$ perl -l t.pl Sat May 11 14:00:07 1996 Sat May 11 14:00:07 1996 I think that message is really from 1998. I'm sorting using $msg->timestamp, so this message is ending up out of sequence. > > So, I thought about writing the mbox manually using > > > > $message->write; > > > > so the output would include the 'From ', but it's not being output. > > How do I get the 'From ' line included in the message output? > > If your message is a Mail::Box::Mbox::Message it will, but other > folder types do not use that line. It is, but I'm still not seeing the leading From line. I think I'm missing your point. moseley@bumby:~/hyper$ cat t.pl use Mail::Box::Manager; my $box = Mail::Box::Manager->new->open('test3') || die $!; my @messages = $box->messages; print $messages[0],"\n"; $messages[0]->write; moseley@bumby:~/hyper$ head -1 test3 From [email protected] Sun May 10 22:57:21 1998 moseley@bumby:~/hyper$ perl t.pl | head -2 Mail::Box::Mbox::Message=HASH(0x85f3c24) Received: from mail.ricsson.com ([202.96.166.214]) No 'From ' line. Is there a $msg method call to get the 'From ' line? -- Bill Moseley [email protected]