Version Build Status Coverage License Stars

imap-backup

Backup, restore and migrate email accounts.

Quick Start

brew install imap-backup # for macOS
gem install imap-backup --no-document # for Linux
imap-backup setup
imap-backup

Modes

There are two types of backups:

  • Keep all (the default) - progressively saves a local copy of all emails,
  • Mirror - adds and deletes emails from the local copy to keep it up to date with the account.

What You Can Do with a Backup

  • Migrate - use the local copy to populate emails on another account. This is a once-only action that deletes any existing emails on the destination account.
  • Mirror - make a destination account match the local copy. This action can be repeated.
  • Restore - push the local copy back to the original account.

See below for a full list of commands.

Installation

Homebrew (macOS)

Homebrew installs

If you have Homebrew, do this:

brew install imap-backup

As a Ruby Gem

gem install imap-backup --no-document

If that doesn't work, see the detailed installation instructions.

From Source Code

If you want to use imap-backup directly from the source code, see here.

Setup

Normally you will want to backup a number of email accounts. Doing so requires the creation of a config file.

You do this via a menu-driven command line program:

Run:

imap-backup setup

As an alternative, if you only want to backup a single account, you can pass all the necessary parameters directly to the single backup command (see the single backup docs).

GMail

To use imap-backup with GMail, Office 365 and other services that require OAuth2 authentication, you can use email-oauth2-proxy to handle authentication, and then connect to the proxy on a local port.

Backup

Manually, from the command line:

imap-backup

Alternatively, add it to your crontab.

Backups can also be inspected, for example via local show and exported via utils export-to-thunderbird.

Commands

For a full list of available commands, run

imap-backup help

For more information about a command, run

imap-backup help COMMAND

Performace

There are a couple of performance tweaks that you can use to improve backup speed.

These are activated via two settings:

  • Global setting "Delay download writes",
  • Account setting "Multi-fetch size".

See the performance document for more information.

Troubleshooting

If you have problems:

  1. ensure that you have the latest release,
  2. run imap-backup with the -v or --verbose parameter.

Development

Activity

See the Development documentation for notes on development and testing.

See the CHANGELOG for a list of changes that have been made in each release.