How can I import a PST file to Gmail?

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 :)


You might want to consider Google App Sync for Outlook which allows you to import directly from a PST.


The most recommend suggestion would be to use the migration tool from Google and set it to run overnight so that its complete by the next morning. Make sure that you select the import new data option so that previously migrated data is not duplicated.

Also a good practice would be to ensure that you dont use emails while the migration is in process but if you need to, you still can access them.


I have tried the Google migration tool, Thunderbird import, translation to MBOX, and a few other semi-automated tools but encountered the "unknown sender" issue. The strongest solution seems to be with an Exchange server in what is essentially a two-step process.

  1. Copy emails from PST to Exchange mailbox (will mirror in IMAP4 mailbox)
  2. Copy emails from IMAP4 mailbox to Gmail mailbox

I was able to follow those guidelines using the pre-configured VHD of Exchange Server 2007 SP1 (evaluation version) and Virtual PC 2007 (free).

MS Virtual PC 2007 SP1 http://www.microsoft.com/en-us/download/details.aspx?id=24439

MS Exchange Server 2007 SP1 VHD http://www.microsoft.com/en-us/download/details.aspx?id=14901

Besides using Microsoft Outlook 2007 to move emails from PST to an Exchange mailbox (will mirror in IMAP4 mailbox), I also found it helpful to use Thunderbird to move emails from the IMAP4 mailbox to Gmail. It worked fine when I tested with Outlook but I prefer the Thunderbird interface and it also helped keep things straight.

Below is the short-hand detail, with many thanks to the posts and references that others provided along the way:

Host PC Desktop -> Start -> Control Panel -> Network Connections -> Properties -> Install -> Virtual Machine Network Services Virtual PC -> Edit -> Settings -> Networking Settings -> Adapter 1 -> Select the desktop network connection that you just updated Virtual PC -> Edit -> Settings -> Shared Folders -> to copy any data or installation files on your host desktop Virtual PC Desktop -> Start -> Control Panel -> Network Connections -> Properties -> TCP/IP -> Obtain IP + Obtain DNS

Exchange Management Console -> Organization Configuration -> Hub Transport -> New Accepted Domain Exchange Management Console -> Organization Configuration -> Hub Transport -> E-mail Address Policies -> Edit -> Add -> Select accepted domain + Set as Reply Exchange Management Console -> Organization Configuration -> Hub Transport -> Accepted Domains -> + Set as default http://exchangeserverpro.com/change-business-email-domain

Exchange Management Console -> Server Configuration > Client Access > POP3 and IMAP4 -> Authentication -> Plain text logon (optional if you are running into issues logging in later) http://exclusivelyexchange.com/how-to-connect-pop-and-imap-clients-to-exchange/

Administrative Tools -> Domain Controller Security Policy -> Account Policies -> Password Policy -> Set preferred requirements (Ex. Disable complexity) Administrative Tools -> Domain Security Policy -> Account Policies -> Password Policy -> Set preferred requirements (Ex. Disable complexity) Administrative Tools -> Services -> Microsoft Exchange IMAP4 -> Start + Automatic

Exchange Management Console -> Recipient Configuration -> Mailbox -> New Mailbox -> User Mailbox -> Create mailbox for new user + Select mailbox database http://technet.microsoft.com/en-us/library/ff406204%28v=exchg.80%29.aspx

Exchange Management Console -> Organization Configuration -> Add Exchange Administrator -> Select user + Exchange Organization Administrator role http://technet.microsoft.com/en-us/library/aa998008%28v=exchg.80%29.aspx

Install Outlook on virtual hard drive (not recommended in general but works for transfer to Gmail) Copy PST file to virtual hard drive

Add Exchange account (uncheck cached Exchange mode) Add PST file

Add IMAP4 account to connect to your Exchange mailbox through IMAP (see account details below) Add Gmail account

[email protected] LITWAREINC/user IMAP: EX07SP1.LITWAREINC.COM:993 (SSL) SMTP: EX07SP1.LITWAREINC.COM:587 (STARTTLS) Test Account Settings -> Should log onto incoming mail server but may not successfully send test e-mail message (not necessary for transfer)

Copy from PST to Exchange mailbox (will mirror in IMAP4 mailbox) Copy from IMAP4 mailbox to Gmail mailbox (I tested this successfully with Outlook but used Thunderbird for the mass transfer)

Note: My trial version expired (incorrectly) and would sometimes restart. Occassionally, I had to restart Microsoft Exchange services. Administrative Tools -> Services -> Microsoft Exchange Active Directory Topology Service -> Restart Administrative Tools -> Services -> Microsoft Exchange Information Store -> Restart