matijs.net — Software

MSGConvert: A .MSG to mbox converter

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 improvements. If you have a file that my latest version fails to handle properly, feel free to drop me a line, preferably including the offending .MSG file. You can also file a bug in the CPAN bug tracker or the GitHub bug tracker.

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

Usage

To use it, run:

msgconvert YourMessage.msg

This will produce a file YourMessage.eml 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 using --mbox, like so:

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

Installing

On any Unix-like system with a reasonably new Perl installed, you can install the Email::Outlook::Message module by executing the following:

cpan -i Email::Outlook::Message
You can run this as root if you would like to install these modules system-wide.

As of version 0.915, Email::Outlook::Message includes the msgconvert script, so you don't need to download or install anything else.

On recent versions of Debian and Ubuntu, you can install msgconvert simply by executing the following:

sudo apt-get install libemail-outlook-message-perl

The packaged versions of Email::Outlook::Message in Ubuntu Trusty and Precise, and Debian Wheezy is not entirely up-to-date so won't include the msgconvert script itself. On those systems, I recommend installing it by hand using the method above.

Development

For the latest source code, go to Email::Outlook::Message on GitHub.

Known Bugs/Issues

Not all data that's in the .MSG file is converted. There simply are some parts whose meaning escapes me. However, most things are converted correctly by now, including plain text, HTML and RTF-formatted message bodies.

Attachments with Apple-style resource forks, as well as PGP-signed email is known not to be converted properly.

Site