Convert emails from Outlook MSG to Thunderbird EML format using MSGConvert

Outlook MSG to Thunderbird EML conversion picture

Recently, I’ve had the need to convert a bunch of outlook MSG files to a format that Thunderbird can read (EML).

There are various ways of doing this according to this article on, but I have chosen the MSGConvert method so I can script the conversion process.

To use MSGConvert, you’ll need the MSGConvert script along with its Perl dependencies (you’ll need to compile one if you are using Ubuntu/Xubuntu).



## Install all dependencies for "Email::Outlook::Message" - "Email-Outlook-Message-0.909"
aptitude install 
libio-string-perl    # Needed to pass "make test"

## Compile "Email::Outlook::Message"
wget    # From
tar -zxf "Email-Outlook-Message"*".tar.gz"
cd "Email-Outlook-Message"*
perl Makefile.PL
make test
sudo make install

## Note: To uninstall
# cd "Email-Outlook-Message"*
# sudo make uninstall
# aptitude purge .....

## Install dependency "Email::LocalDelivery"
aptitude install libemail-localdelivery-perl

## Install
wget '' -O
sudo mv /usr/bin

MSGConvert usage

Once installed, you can convert a single message by doing: some_message.msg

# Please note the script chucks out a file with a .mime extension, it's an easy fix:
mv some_message.msg.mime some_message.eml


Alright, let’s automate it a little bit. Here is what I used to convert a bunch of msg files to eml:



if (( $(echo "$1"|grep -icE "^-[-]?(help|h)$")==1 || $#==0 )); then
	Wrapper script for throws out the converted eml files in current directory and with the wrong extension...
	I suppose I ^could^ just edit  Meh...

	$(basename "$0") msgFile1.msg [msgFile2.msg] [msgFile3.msg]...

	$(basename "$0") messages/message1.msg messages/message2.msg messages/message3.msg
	find "emails/2009" -iname "*.msg" -print0|xargs -0 $(basename "$0")
	exit 0

## Convert each message specified
for message in "$@"; do
	# Test to ensure it has a .msg extension (I ^could^ do a "hd|grep" test or add a "file" magicfile I suppose...  Again, meh...)
	if (( $(echo "$message"|grep -icE ".msg$")== 1 )) && [ -f "$message" ]; then
		# Convert - we can only do this one at a time
		echo "INFO: Converting: "$message""
		"$MSGCONVERT" "$message"
		if (( $? != 0 )); then echo "EXCEPTION: Encountered problem(s) at "$message"."; fi
		# Move the converted message to its original directory, changing extension at the same time
		#echo "DEBUG: mv "$(basename "$message".mime)"" ""$(echo "$message"|sed -e 's/.msg$/.eml/i')""
		mv "$(basename "$message").mime" "$(echo "$message"|sed -e 's/.msg$/.eml/i')"

Happy converting!


2 Responses to “Convert emails from Outlook MSG to Thunderbird EML format using MSGConvert”

  1. E Hansen Says:

    Thanks a lot for your great explanation on how to install MSGConvert. The script works great after following your installation. If only I have discovered it earlier, it would have saved me many wasted hours…

    I’m still trying to figure out how to customize the automation script, though. I need to convert approx 15000 .msg files that are scattered down a directory tree. The automation script would need to traverse through the directory tree, convert all .msg files it finds to .eml files – and delete the original .msg files as it goes……

  2. norb ebeis Says:

    Here is bash script which traverses a directory tree and converts all *.msg files to *.eml. files ( The *.mime files which are created by are renamed to *.eml and moved to the directory of the original msg file).

    function convertMsg {
    echo Directory “$1”
    find “$1” -iname ‘*.msg’ | while read -r msgFile
    echo Handling “$msgFile”
    # parse found name in path and filename with and without extentsion
    dirName=`dirname “$msgFile”`
    baseName=`basename “$msgFile”`
    # run convert script “$dirName/$baseName”
    # move created mime file to source directory
    mv “$baseName”.mime “$dirName/$fileName”.eml

    for param in “$@”; do
    convertMsg “$param”

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: