[volunteers] (forw) [Mailman-owner] Auto-discard notification

Don Marti dmarti at zgp.org
Sat Apr 14 16:14:40 PDT 2007


begin Rick Moen quotation of Sat, Apr 14, 2007 at 02:06:12PM -0700:

> I've now found and remove all of the flush-left "From " references that
> had prevented the mbox file from being parsed correctly, but not yet the
> character-encoding gotcha that's still crashing the archiver. 

Sounds like one of those UTF-8 switchover things.
(It's like moronquotes for Perl!)

In case it helps, here's a script to go through an
mbox file and print out the Message-IDs until it gets
to the bad one, when it should die.


#!/usr/bin/perl

# sudo apt-get install libemail-simple-perl \
#                      libmail-mbox-messageparser-perl

use Mail::Mbox::MessageParser; 
use Email::Simple;

unless (-f $ARGV[0]) {
    print STDERR "Usage: $0 [mbox file]\n";
    exit(1);
}

my $file_name = $ARGV[0];
my $file_handle = new FileHandle($file_name);

my $folder_reader =
   new Mail::Mbox::MessageParser( {
   'file_name' => $file_name,
   'file_handle' => $file_handle,
   'enable_cache' => 0,
   'enable_grep' => 0,
} );

while(!$folder_reader->end_of_file()) {
    my $msg = new Email::Simple(${$folder_reader->read_next_email()});
    my $id = $msg->header('Message-Id');

    if ($id) {
        print "$id\n";
    } else {
        print "no Message-Id.\n"
    }
}



-- 
Don Marti                    
http://zgp.org/~dmarti/
dmarti at zgp.org



More information about the volunteers mailing list