Converting Mailman Archives

From Dev411: The Code Wiki

GNU Mailman provides public archives via a monthly text .tar.gz file. It has been noted that the files, while similar to, are not in the mbox format. The mbox format would allow a user to import the files into another mail reader. Since Mailman uses the mbox format internally, many have suggested that they should make those files accessible in addition to the text archives.

There have been several solutions created to convert Mailman archives back to the mbox format, however some have noted that there isn't enough information in text archives to full recreate the email messages.

Some methods to convert the text archives back to mbox are listed below. A solution similar to Craig's below could successfully convert a Mailman archive to be read by Perl's Email::Folder, but the resulting file could not be imported successfully into MHonArc 2.6.15 (all the messages would appear as a single long message).

By Craig Sanders (http://lists.debian.org/debian-isp/2001/11/msg00104.html)

#! /usr/bin/perl -ni.bak

use Date::Parse ;
use Date::Format ;
$template = "%a %b %d %R:%S %Y" ;

if (/(^From )([^        ]*) (.*)/) {
    $time = str2time($3) ;
    $date = time2str($template, $time) ;
    print "$1$2  $date\n" ;
} else {
    print ;
} ;

By Benjamin A. Okopnik (http://linuxgazette.net/112/lg_tips.html#tips.7) on Linux Gazette

gzip -dc 2004-December.txt.gz|perl -0 -wpe's/^(From [^\s]+) at /\n$1\@/gsm;s/^\n//s' > mail.box

By Dobrica Pavlinusic (http://www.rot13.org/~dpavlin/) : mailman2mbox.pl (http://svn.rot13.org/~dpavlin/svnweb/index.cgi/perl/checkout/trunk/mailman2mbox.pl?rev=35)