Migrate email from Outlook to Gmail

My dad was using Outlook 2000 as a POP3 client with a local Estonian email service provider who doesn't do IMAP and don't provide a decent webmail client, so my dad had about 10 years worth of email stored on his laptop. His brother kindly donated it to him a while back, but with 256 MB of RAM, running Windows XP with antivirus software, the machine had become a little bit unusable. I'm not 100% decided yet on what to do about hardware and OS for him (he's on a Dell Mini 9 with Ubuntu at the moment), but I'm definitely in favor of not storing all his mail locally to allow easy access from anywhere and to reduce chances of loosing it all to a failed hard disk. He seemed receptive to giving Gmail a try, so here's how I migrated his email.

Outlook 2000 can't do IMAP and I didn't have a license/media for a newer version, so I thought I'd install Thunderbird on his Windows XP laptop, set it up as an IMAP client for Gmail and import mail from Outlook. Unfortunately, Thunderbird was unable to import from Outlook 2000 due to some MAPI error. Found a Microsoft KB suggesting a solution, but unfortunately it required the Microsoft Office media, which I didn't have. I then thought perhaps the error was Thunderbird specific and installed Outlook Express through add/remove Windows components. Sadly, Outlook Express had the same problem importing email from Outlook as Thunderbird. Additionally, Outlook now began launching the Office installer every time I would click on a different Personal Folder (my dad's 12K messages were for some reason split up among several of them), of course, lacking the Office media the installer would eventually fail, but it annoyingly kept on trying anyway. By this point, I've had enough of this old laptop with error spewing Micro$oft software, so moved all his mail into a single Personal Folder, exported it all into a single pst file and moved it over to my Debian Testing (Wheezy) laptop through a USB flash drive.

I was now left with a proprietary Outlook pst file on a Linux box. Fortunately, Debian's massive library of free/libre/open-source software has a few apps that can liberate mail from a pst file. First one I tried was readpst and it worked:

sudo aptitude install readpst
cd /path/to/pst/
mkdir oldmail
readpst -o oldmail -r 2011-08-18.pst
Opening PST file and indexes...
About to start processing first record...
Processing items...
Processing Folder "Deleted Items"
	"Deleted Items" - 114 items done, skipped 0, should have been 114
Processing Folder "Inbox"
	"Inbox" - 11137 items done, skipped 2, should have been 11139
Processing Folder "Outbox"
	No items to process in folder "Outbox", should have been 0
Processing Folder "Sent Items"
	"Sent Items" - 630 items done, skipped 0, should have been 630
Processing Folder "Calendar"
	"Calendar" - 161 items done, skipped 0, should have been 161
Processing Folder "Contacts"
	No items to process in folder "Contacts", should have been 0
Processing Folder "Journal"
	No items to process in folder "Journal", should have been 0
Processing Folder "Notes"
	No items to process in folder "Notes", should have been 0
Processing Folder "Tasks"
	No items to process in folder "Tasks", should have been 0
Processing Folder "Drafts"
	No items to process in folder "Drafts", should have been 0
	"Personal Folders" - 0 items done, skipped 0, should have been 0
Finished.

Now I've got plain text mbox files containing all his mail, to make them available to Thunderbird, shut it down, then made shortcuts to the Inbox and Sent Items mbox files inside my Thunderbird profile's Local Folders directory:

cd "~/.icedove/XXXXXXX.default/Mail/Local Folders"
ln -s "/path/to/pst/oldmail/Personal Folders/Inbox/mbox" Inbox
ln -s "/path/to/pst/oldmail/Personal Folders/Sent Items/mbox" Sent

Started up Thunderbird and voila -- the nearly 12K messages are there in Local Folders. Yay!

Now just enabled IMAP in his Gmail account, added it in Thunderbird and moved Inbox messages to Inbox in Gmail and Sent Items into a newly created "Old Sent Mail" folder in Gmail. It took a while, but it worked.

Then added his old POP3 account in Gmail so messages sent to it will show up in his new mailbox. One thing I wish Gmail could do is notify senders of messages to the old POP3 account to use the new Gmail account, but sadly it seems Gmail can only do a general vacation type response, not rule based replies to messages matching some criteria. The powerful Sieve mail filtering language is one of the reasons why I still run my own mail server.

Leave a comment

NOTE: Enclose quotes in <blockquote></blockquote>. Enclose code in <pre lang="LANG"></pre> (where LANG is one of these).