Saturday, August 28, 2010

Using Thunderbird to Back Up IMAP Email

The main problem with keeping all your email in the cloud is the possibility that it will be lost. Yes, generally Google and others are reliable, but things do happen, and accounts get wrongly deleted, so having a backup is always handy. Unfortunately Gmail doesn't come with easy to use Import/Export features that let you upload and download zip files containing your entire tree, nor do others. The good news is that with IMAP, it isn't too intolerably difficult to use IMAP to backup your mail and restore it using the free Thunderbird Mail client.

First, I recommend that you start a new profile entitled "Backup" (or whatever) using the Thunderbird Profile Manager (thunderbird -ProfileManager). Now that your in your new Backup Profile in Thunderbird 3.x, do this:

  1. Set up your IMAP account. Thunderbird makes this as painless as possible (including by prompting you to do it when you start a new profile), unless you're using something like Google Apps, in which case you'll have to do it manually.

  2.  
  3. Turn off indexing and smart folders. Not absolutely necessary, but helpful, since we don't need it and it will get in the way. Uncheck Edit->Preferences->Advanced ->General->Enable Global Search and Indexer. As for Smart Folders, hit View->Folders->All.

  4.  
  5. Go offline and say yes when it asks you to sync. Standard procedure in Thunderbird 3 is to set new accounts to download everything by default, so it should proceed to download everything. File->Offline->Work Offline.

  6.  
  7. Create a folder under Local Folders entitled Backup.

  8.  
  9. Select all folders in the account you want to backup (except the [Gmail] folder and its subfolders if you're using Gmail) and drag-n-drop them in the folder you just created. They will be copied.

    1. If you are using Gmail, and you followed my instructions, go ahead and copy [Gmail] over now. If you didn't, you'll probably notice that the copy stopped after [Gmail]. Why? I have no idea. But it does, which is why I told you not to copy it with the rest.

    2.  

     

  10.  
  11. Right click on Local Folders and select Settings. Click Browse (next to the path where Local Folders is stored on your computer). Zip up all files and directories named "Backup".

  12.  
  13. Delete the Backup folder in Thunderbird.

  14.  
  15. Launch the Thunderbird Profile Manager again, delete the Backup profile if you want to (or save it for next time if you're not worried about disk space), and start your normal profile.

  16.  

Restoration involves simply dropping the saved files into Local Folders again (while Thunderbird isn't running).

You could have just copied the files out of the IMAPMail directory, but I find that that has issues associated with it (some messages don't come through right, read data is lost). This method avoids those. And it also doesn't require the use of any extensions.

Note: If you have a lot of mail on the server, expect this to take a long time. Also it will take a lot of space, especially if you're using Gmail. Each message will have to be downloaded multiple times: once for each label it has and another for All Mail, which means you can expect to have it download and store every message at least twice (unless you archive everything and avoid labels like the plague).

No comments:

Post a Comment