Gmail – How to import mail from one Gmail account to another, preserving the label structure

data-liberationgmailgmail-labels

I'd like to import mail from one account to another, but I have 10 or so labels in the one I want to export from. What's the easiest way to get the same labels on the same email messages on the new account?

Best Answer

I successfully used Got Your Back (GYB) to move 7 years of messages (with labels!) from a @gmail.com account to my new Google Apps account at my own domain. Here's how:

Backing up your old @gmail.com account

  1. Download GYB and unzip it somewhere. (I'm on a Mac so I used the "Python Source" version, but if you're on Windows you'll need that version instead.)
  2. Open a command prompt or terminal and change to the folder you unzipped GYB into.
  3. Use the following command to make a backup of your old Gmail account. If you're using the Windows version, replace the python gyb.py part with gyb.exe.

    python gyb.py --email=youremail@gmail.com --action=backup

  4. GYB will open a web page to request access to your old Gmail account. Sign in with your old Gmail credentials and grant it access.
  5. Wait for your mail to be downloaded. I had 800 MB of mail in the account, and it took around half an hour.

By default, the backup will be located in a folder named GYB-GMail-Backup-youremail@gmail.com.

Restoring the backup to your new Google Apps account

  1. Type the command below. Again, if you're on Windows, replace python gyb.py with gyb.exe.

    python gyb.py --email=newacccount@yourdomain.com --action=restore --folder=GYB-GMail-Backup-youremail@gmail.com

  2. Once again, GYB will open a web page so you can grant it access. Be sure to sign in to your new Google Apps account this time.
  3. Switch back to GYB and wait for your backup to be restored to the new account. This took much longer for me -- at least 4 or 5 hours with 800MB of mail.

Limitations

  • After I restored the backup, my old sent messages were labeled "\Sent" instead of actually being listed under Sent Messages. I'm assuming this is because it's not possible to actually place a message in the Sent Messages "folder". I just renamed the label to something like "Old Sent Messages".
  • Filters are not backed up, but there is a feature available in Labs that allows you to export/import them separately.
  • Chats, Spam and Trash are not exported.
  • Multi-word labels ended up being duplicated. I had a label named Work Stuff, and all of its messages were labeled both "Work and Stuff" after the restore. I just deleted one of the duplicates and renamed the other.
  • I don't know if a message's starred status is exported, since I didn't have any.