convert .eml to .mbox in win32


Mike James

Hi, I'm working with some code I copied from here:

My system: WinXP Home, ActiveState Perl 5.6.1, operated by Perl newbie...

The script is supposed to descend into sub-folders, read *.eml messages,
then concatenate them into .mbox files. The problem is that the script
doesn't descend into the sub-folders. Instead, it only operates on the
files (and folders) in the folder where the script is located.

Here's the script for

sub convert
my ($file) = @_;
my $from = '';
my $date = '';
my $message = '';
my $stop_looking = 0;

open OE, "<$file";

while ()
my $line;
$line = $_;

$message .= $_ . "\n";

if ( $stop_looking == 0 )
if ( $line =~ /(From:.*\<(.*)\>)/ )
$from = $2;
if ( $line =~ /(From: ([^\<]*))/ )
$from = $2;

if ( $line =~ /Date: (.*)/ )
$date = $1;

if ( $date =~ /(\w{3}), (\d+) (\w{3}) (\d{4}) (\d\d:
\d\d:\d\d)/ )
my ($dow, $day, $month, $year, $time) = ($1,

if ( $day =~ /0(\d)/ )
$day = " $1";

$date = "$dow $month $day $time $year";

if ( $line =~ /X-UIDL:/ )
$message = "\n\nFrom $from $date\n" . $message;

$stop_looking = 1;

close OE;

return $message;

sub convert_folder
my ($folder) = @_;
my @files = glob "$folder/*.eml";

open MBOX, ">$folder.mbox";
foreach my $file (@files)
print "File $file...\n";
print MBOX convert( $file );
close MBOX;

my @folders = glob '*';
foreach my $folder (@folders)
print "Converting $folder...\n";
convert_folder( $folder );

Jonathan N. Little

shakespeare1 said:
Today, many users are facing troubles about how to convert messages from Windows Live Mail into Thunderbird. Conversion of Live Mail to Thunderbird is not easy task because both supports different email format. Windows Live Mail supports .eml format while Thunderbird supports MBOX format. Without any help of third party tool, Live Mail to Thunderbird conversion is not possible.

In this situation the EML to MBOX Converter is reliable solution to convert your mail messages from Windows 7 mail into Thunderbird, The software also allows you to open or view .eml files into .mbox format with complete emails data like - Mata data (To, Cc, Bcc, Date, Time, From), Attachments & attachment, Content style and Formatting, Image, Hyperlink, Sub-folders & Email folder etc. For more information view below link >>

You can just drag and drop EML files directly into Thunderbird no
problem-o. Thunderbird could always import from Outlook and
OutlookExpress with no addons required, not sure about Windows Live
Mail, but if you export as EML Thunderbird has no problem with that

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Latest member

Latest Threads