Importing an Outlook PST into Gmail (Avoid “Unknown Sender” Bug)

This is a quick guide on how to import Outlook PST’s into GMail with all information (such as the “To:” field) preserved completely.

Most guides on the internet say you can import emails stored in PST’s into GMail by mounting both the PST and GMail account (via IMAP) in Outlook and copying them over. However, if you have any internal domain emails (between two users within the same domain) you will find that when you check the emails using the GMail web interface, they will simply say “(unknown sender)”. The solution to fix this is normally simply to add both accounts via IMAP and copy the emails that way, as the Outlook IMAP connector will perform the necessary the conversion. However, if you are still reading, you are probably in one of the following situations:

  • You no longer have access the Exchange Server.
  • The Exchange Server doesn’t have IMAP enabled.


  1. Setup a Windows Server environment.
    • You can use a physical machine or a virtual machine. I used VMware Workstation to create a virtual machine. (Use bridged networking)
    • Install a Windows Server OS (That will support your version of Exchange.)  I used Windows Server 2003 x86. (Configure it as a domain controller as per normal.)
    • Give the machine a static IP address.
    • Install Microsoft Exchange (and all its prerequisites – you should add the “Application Server” role with ASP.NET, and install anything else that is missing via Add/Remove Programs –> Windows Components)
    • Enable the IMAP4 connector in Outlook. (Go to services.msc and enable/start the “Microsoft Exchange IMAP4” service, then go to Exchange System Manager and ensure the connector is configured correctly under <YourDomain>\Servers\<YourServerName>\Protocols\IMAP4\)
  2. Unless you want to join the domain you just created, you will want to edit your hosts file (normally located at C:\Windows\System32\drivers\etc\) :
    • Get the machine name of your Windows Server. (In this example, it will be “mainserver”)
    • Get the FQDN of your domain. (In this example, it will be testdomain.local)
    • Combine the above two names so you get something like this: mainserver.testdomain.local. (Where the IP is your server’s address).
  3. Open up Outlook and do the following:
    • Add your newly created Exchange email account to Outlook. (As an Exchange account.)
    • Mount your PST under Outlook.
    • Copy anything you want to keep from the PST to the Exchange account.
    • Remove the Exchange email account from Outlook.
    • Now, re-add the Exchange email account using IMAP4. Subscribe to the necessary folders.
    • Add your GMail account to Outlook via IMAP.
    • Copy your emails across from the IMAP account to GMail.
  4. Your emails should correctly appear under GMail!

References: [1], [2], [3]

5 thoughts on “Importing an Outlook PST into Gmail (Avoid “Unknown Sender” Bug)”

  1. Hi there,

    Is it correct that this workaround is obsolete nowadays?
    I faced the two common gmail import issues (date stamps of import, not receival, and this nasty ‘unknown sender’ thing), and just tested a small set of those problematic mails in the following way:

    Outlook 2007: move mails from PST files to a subfolder of local folders, detach pst.
    (attached gmail account and copied them, to confirm the problem, indeed: messy dates and empty from fields @ gmail)

    Then, i installed Thunderbird (fresh install), and simply had it import mail data from outlook. After that, i already saw the correct headers in TB, and managed to upload them to gmail just fine.

    Next quest(ion): how will this trick hold when moving 8Gb of mail between Outlook and TBird :)

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

    MS Virtual PC 2007 SP1

    MS Exchange Server 2007 SP1 VHD

    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 (especially Joel J) 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

    Exchange Management Console -> Server Configuration > Client Access > POP3 and IMAP4 -> Authentication -> Plain text logon (optional if you are running into issues logging in later)

    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

    Exchange Management Console -> Organization Configuration -> Add Exchange Administrator -> Select user + Exchange Organization Administrator role

    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

    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

Leave a Reply

Your email address will not be published. Required fields are marked *