matijs.net — Software

MSGConvert: A .MSG to mbox convertor

Introduction

I wrote this to be able to convert some .MSG files I had lying around. These files are produced by some of Microsoft's e-mail programs, and I couldn't read them on my home machines, which run Linux.

Originally, I had only six of these files to base my program on. However, several people sent me .MSG files that my program failed to convert (Thanks!), or other feedback, so I've been able to make some improvents. If you have a file that my latest version fails to handle, feel free to drop me a line, preferably including the offending .MSG file.

Important: Not all data that's in the .MSG file is converted. There simply are some parts whose meaning escapes me. Formatting of text messages will also be lost, if it's done using RTF.

If you have any questions, first take a look at the FAQ.

Usage

To use it, run:

perl -w msgconvert.pl YourMessage.msg

This will produce a file YourMessage.mime containing the message in RFC822 format. The program will complain about unrecognized OLE parts and other problems on stderr. If you supply the option --verbose, it will also tell you what OLE parts it knows about but doesn't use, and what I think they are. The option --help will make it print some usage information.

You can also let MSGConvert deliver all .MSG files in one mbox file usign --mbox, like so (assuming you made msgconvert.pl executable):

msgconvert.pl --mbox some-mbox-file *.msg

Latest Changes

October 14, 2007 The heart of MSGConvert is now available as a Perl module on CPAN, so you can now incorporate it in your own programs.

Download

You will need to get a version of Perl and download the modules Email::Outlook::Message, Email::LocalDelivery, Getopt::Long, Pod::Usage, File::Basename and their dependencies from CPAN.

You can search for the dependencies at CPAN, or use Perl's CPAN module, or they may be packaged for your particular distribution.

Finally, download the script itself.

To examine the OLE structure of the .MSG files I used a modified version of one of the examples that comes with OLE::Storage_Lite.

Site