IMAP backup

From MozillaZine Knowledge Base
Revision as of 10:00, 27 February 2013 by Tanstaafl (talk | contribs)
Jump to navigationJump to search

It is straightforward for backup programs like Mozbackup to backup POP accounts since the messages are stored within the profile. IMAP accounts are designed to use messages stored in remote folders on the IMAP server. Mozbackup is oblivious of those message's existence.

Starting with Thunderbird 3.0 offline folders are enabled by default by Tools -> Account Settings -> Account_name -> Synchronization & Storage -> "Keep messages for this account on this computer". An offline folder has a a copy of any message that had ever been in the corresponding remote folder. Deleting a message in the remote folder, emptying the trash and compacting the folder has no effect on the contents of the corresponding offline folder. Offline folders are currently stored as mbox files, just like mail folders for POP accounts and Local Folders. The offline folder for a inbox would be a "inbox." file. The *.msf files don't have any messages, just headers and some status information.

When you are working online (File -> Offline -> Work Online) the folder listing shows the contents of the remote folder. When you are working offline (File -> Offline -> Work Offline) network activity is disabled and it shows the contents of the corresponding offline folder, if it exists. You can also switch between working online and offline using the icon that looks like two blue PC's next to each other in the lower left corner of the main window. Unless you synch the remote and offline folders using "File -> Offline -> Download/Sync Now" those folders are not really synchronized, despite the menu being called Synchronization & Storage.

Recommended solution

The easiest way to backup an IMAP account is to automate backing up a profile that contains offline folders. Mozbackup supports command line arguments that can be used to run it under Windows task scheduler. The ImportExportTools add-on has an option to schedule backups. However, you could backup the remote folders without creating offline folders. One solution would be to copy the messages to another IMAP account that you use just for backups. A free Gmail IMAP account has a mailbox of over 10GB.

You could also use a program to backup/restore the contents of your IMAP mailbox (independent of Thunderbird). IMAPSize would be a good choice if you are running Windows.

Filters

  • You could use message filters to automatically copy new messages from one account to another. The main limitation is that message filters are only run automatically for the inbox folder.
  • You could use a server side filter to automatically copy the messages between the accounts. Some email providers such as Fastmail.fm, Runbox, and Tuffmail support the Sieve mail filtering language . That would let you use a redirect :copy command to copy the message to another account without effecting the original message. If you want to backup from one Gmail account to another you'd have to use a forward command in the filter since they don't support Sieve. Typically you use webmail commands (from a browser) to edit/create server side filters. The filters are automatically run whenever the server gets a new message in the mailbox, you don't have to login or check for new mail to run them.

Email forwarding service

  • An email forwarding service is useful if you have a personal domain since it lets you easily change where you read your mail from, without getting a new address. You could use a email forwarding service like POBox that does not add any visible headers when it forwards a message to automatically store a copy of every new message in another IMAP account.

Mailbox synchronization

  • Use imapsync to copy the messages. It requires that you install Perl. See this web page for a writeup with screen shots.
  • Use MailSync . It is designed for a Unix/Linux like operating system though you may be able to run it under Windows if you also install cygwin. Its written in C so you don't need to install an interpreter such as Perl or Python.
  • Use offlineimap . It is designed for a Unix/Linux like operating system though "With some fiddling, it reportedly ran under Windows as well".
  • isync. Its also known as mbsync. Not to be confused with Apple's iSync program for mobile phones. It supports IMAP and Maildir mailboxes.

IMAP backup

  • Use a Windows utility like IMAPSize to backup the messages as .EML files. It does an incremental backup - it won't backup a message again if its already backed up. You can use it to restore any backed up messages or use the ImportExportTools add-on to import the *.EML files into Local Folders, and then move the messages to a remote folder. Since it supports command line arguments you could automatically run it using the Windows Task Scheduler.
  • Use a Python script such as Imap Backup Tool to backup the folders as mbox, mbox.gz, or mbox.bz2 files. It supports incremental copying from any/all folders. It doesn't backup IMAP flags (tags). IMAPSave is another one. It only stores the messages in mbox files and does not do incremental backups. Both of these programs only do backup, but you could use the ImportExportTools add-on to import the mbox files.
  • imap2maildir is a Python script [1] to backup a IMAP mailbox to maildir files. Thunderbird 12 added support for maildir files but they're not useful yet as there is no support for converting mbox based accounts etc. yet.
  • If you are using Linux or OS X you could use fetchmail and procmail to backup a IMAP mailbox to mbox or maildir files.

Commercial services

  • If you are using a host such as Dreamhost, HostGator, HostMonster, BlueHost, Siteground etc. you can backup all your IMAP accounts under your cPanel by using its full backup feature.
  • IMAP Backup and Archiver will schedule backups of IMAP accounts to Amazon Web Services (EC2, S3).
  • IMAP Backup & Archiver
  • Backupify and Spanning backup Google Apps.
  • SpinBackup for both Google Apps (commercial) and individual Gmail accounts (free, limited to 5GB). It uses Amazon Web Services (EC2, S3) to store the backups.

There are lots of other programs/scripts to synchronize mailbox's or backup remote folders. However its best to stick with something well known that is actively maintained.

See also

External links