07 February 2012

Using Thunderbird to back up Email from GMail (or using Icedove)

UPDATE: This HowTo article still holds true, but I've recently found the FLOSS, far-easier-to-use application Gmail Backup, located here.  GPLv3 and full of easy.

================

Mozilla Thunderbird (or the unbranded Icedove) is a Free-Software mail client for the desktop, allowing you to uson the desktop in a dedicated app, rather than a browser interface (like the GMail.com web interface, for example).  At work we use Icedove to back up employee email after they depart, so that we have their emails if needed.

This works generally well for a backup of corporate email and personal email, weather with Google Apps or another provider, although it does require some adjustments.  I've also had issues with Thunderbird crashing occasionally while trying to back up over 30 mailboxes at once, so be prepared for issues there, perhaps with a 'while, do, done' script (explained here).

The resulting downloaded emails are in the mbox file format, which I personally dislike due to being a single point of failure (like Microsoft's Outlook PST files, or most MS products IMHO).  On the other hand, this mbox file is a standard that other apps can read and which can be loaded into other apps or other versions of Thunderbird, cross-platform and all.  Also, there are scripts available to convert from mbox to maildir if that is required.

Setting up a Thunderbird (or Icedove) account isn't enough, however.  First you need to enable IMAP within your GMail or Google Apps account, under the Email Settings.  Once you have this set, download and install Icedove or Thunderbird:
root#  aptitude update && aptitude install icedove

Once installed, we have a few settings to change to enable this to download all email.  Launch Thunderbird (or Icedove) and open the Edit menu > Preferences (on a Windows setup, this is Tools menu > Options for some reason), browse to the Advanced section, General tab, and click the [Config Editor...] button; a new window should open, warning about changing settings which may void your warranty.  Click the [I'll be careful, I promise!] button and let's get started!

At the top, in the Filter section, type in:
mail.server.default.autosync_offline_stores
Make sure that is set to True; double-click to change this if it is not.  If that doesn't exist, right-click in the blank area to add New > Boolean and set the preference name to 'mail.server.default.autosync_offline_stores' (no quotes).

Clear that filter (using the broom icon to the right) and add this new filter:
mail.check_all_imap_folders_for_new
Set that config option to True as well; if this doesn't exist, add it by right-clicking a blank area and add New > Boolean, preference name set as 'mail.check_all_imap_folders_for_new' (no quotes) and set that to True.  This will download mail from all folders by default, not just the Inbox.

Filter for this setting and set this to True:
mail.server.default.check_all_folders_for_new

Filter for this and ensure it is set to False:
mail.imap.use_status_for_biff

To prevent issues with an 'unresponsive script' with Script: resource:///modules/iteratorUtils.jsm:117, set this from the default 10 to a new value of 30:
dom.max_script_run_time

Finally, filter to find the setting:
mail.attachment.store.version
and right-click that > modify to have a value of 1.



Close these windows up and you're set.

Now you should be able to add email accounts (IMAP) and your Thunderbird should download the full email account, not just new emails or the folders which you manually open individually.  In reality, however, I've still found it beneficial to open each folder to force the software to download those messages.  If anyone can tell us a way to fix this I'd appreciate it.  A quick-ish way to do this, in the meantime, is to pick the top folder on the left with your mouse, and then use the keyboard to continually press [Right Arrow][Down Arrow], over and over, to expand each folder and navigate to it.

Your files are stored in your user's homedir, for example at
/home/username/.icedove/{profile-random-string.default}/
or maybe
/home/username/.mozilla/thunderbird/{profile-random-string.default}/ImapMail/imap.googlemail.com/


Did this work for you?  Any suggestions on how we could improve this information?

0 comments: