/gmail-mail-importer

Mail Importer for Gmail will upload the contents of a Thunderbird mail archive to Gmail and do its best to preserve the read state, flagged state, and folders of the messages.

Primary LanguageJavaApache License 2.0Apache-2.0

Mail Importer for Gmail

Do you have an old Thunderbird mail archive that you POP3ed down from AOL?

Do you want to move those old messages to Gmail so that you can use the Gmail app on your phone and still have access to everything?

If so, maybe Mail Importer for Gmail is for you!

If you are trying to bulk import mbox format files to Google Workspace, you should probably look at import-mailbox-to-gmail.

DISCLAIMER: This is not an official Google product.

What does it do?

Mail Importer for Gmail will upload the contents of a Thunderbird mail archive to Gmail and do its best to preserve the read state, flagged state, and folders of the messages. As messages are uploaded verbatim, Gmail will have an exact copy, including all attachments and headers.

Mail Importer also makes sure to only upload messages that aren't already in Gmail. This makes it easy to re-run the import multiple times if something goes wrong.

How can I run it?

Currently, Mail Importer for Gmail is in early development. It is not user friendly in any way. If you are not a developer, you probably want to stay away.

Getting a Client Secret

Each developer needs a client secret to identify their version of Mail Importer to Google using OAuth2. To get a client secret, you have to create a project in the Google Developers Console, configure it correctly, then download the generated credentials. The result should be a JSON file named something like:

client_secret_729820383-898athoe9t33ntohuoc.apps.googleusercontent.com.json

You need to copy this to src/main/resources/client_secret.json in your Mail Importer project. Never check in this file! It is your key and no one else's.

Building Mail Importer

Mail Importer uses Maven. This means that it will download all of the necessary dependencies automatically when you build it like this:

mvn clean package assembly:single

This will produce a runnable .jar file in target/mail-importer-1.0-SNAPSHOT-jar-with-dependencies.jar.

Running Mail Importer

Once Mail Importer is built, you can run it like:

java -jar ./target/mail-importer-1.0-SNAPSHOT-jar-with-dependencies.jar \
    --mailbox DIRECTORY

where DIRECTORY is the Thunderbird mailbox to open.

Note that the Thunderbird Mail directory usually has several sub-directories called ImapMail, OfflineCache, and Mail. Then under Mail, you should find individual accounts, like pop.mail.yahoo.com or pop.csi.com, and Local Folders. It is this last level of directory that contains the actual mailbox.

For example, if you had old CompuServe mail on a Mac, you might run Mail Importer like this:

java -jar ./target/mail-importer-1.0-SNAPSHOT-jar-with-dependencies.jar \
    --mailbox /Users/me/Library/Thunderbird/my_profile/Mail/pop.csi.com

Can I help make Mail Importer better?

You bet! See the CONTRIBUTING.md file for more information.