Outlook – How to import a PST file to Gmail

emailgmailimportmicrosoft-outlook

I'm in the process of moving my email to Gmail. I used to use Outlook and I have a massive amount of email stored in various PST files (about 7GB worth). Ultimately I'd like to store this all in Gmail so I have my entire email archive available.

I imported my first PST file using Outlook's IMAP feature – dragging the folders in one by one. This worked, but was quite slow and laborious (since I had to check on it every few minutes and set the next folder going).

Is there any way I can do the import – either without using Outlook, or by somehow just setting it to go and leaving it overnight without any intervention?

I did look at using Google Sync for Outlook, but it looks like this will also pull down all of the email I've already uploaded, which ideally I'd like to avoid (although if this is the only option I'll do that!)

Best Answer

I have recently run into the same problem, and needed to export close to 10GB of pst files to gmail. I also tried to use Outlook, but gave up as the process was unreliable. Here's a brief rundown of what I did, in the hope that other people will find it useful:

1) First, if you have a google apps account, just use the official "Google Apps Migration tool". If you're like me and are stuck with a normal account, read on.

2) You need to convert your PST files to the much more simple MBOX format. This can be done with Thunderbird and its import wizards which communicate directly with outlook, but I used the open source program readpst (part of the libpst project). I use Linux and simply got it from my package manager, a google search revealed a windows version here. Once finished you will have multiple mbox files, one for each mail folder (Inbox, Sent items, etc..)

3) Once you have your mbox files, use the excellent python script IMAP Upload. The scripts takes your gmail credentials, a single mbox name as input and an output folder (label) on the Gmail server.

This is what allows this difficult process to complete successfully. The script will automatically retry each mail upload on failure, and works on a single mbox file. I used a bash loop to process all my different (50+) mail folders automatically, and just let it upload for two days.

Note: This script has a problem with non-english folder names. Since most of my folder names were hebrew, I had to apply a small fix to the python file. I'll try to send it to the author. Also, gmail doesn't allow labels with multiple spaces between words, so if one of your mbox filesnames is like that be sure to fix it.

Other useful things: MBOX is a very simple format. It's really just a long text file containing all of your emails. I had multiple pst files which represented yearly archives. This means that I had the same folders in multiple pst files. Because MBOX is so simple, you can merge mailboxes by simply appending one file to the other. This allowed me to write a simple script that merged MBOX files with the same name, and very simply flatten out all of my pst files to a set of unique folders, containing all of my mail.

That's it, hopefully everything will work for you as expected :)

Related Question