joeyates / imap-backup

Backup and Migrate IMAP Email Accounts
MIT License
1.37k stars 75 forks source link
backup imap ruby

Version Build Status Coverage License Stars Activity

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:

What You Can Do with a Backup

See below for a full list of commands.

Installation

Docker or Podman If you have Docker or Podman installed, the easist way to use imap-backup is via the container image. You'll need to choose a path on your computer where your backups will be saved, we'll use `./my-data` here. If you have just one account, you can do as follows ```sh docker run -v ./my-data:/data -ti ghcr.io/joeyates/imap-backup:latest \ imap-backup single backup \ --dns 8.8.8.8 \ --email me@example.com --password mysecret --server imap.example.com \ --path /data/me_example.com ``` Podman will work exactly the same. If you have multiple accounts, you can create a configuration file. You'll need to choose a path on your computer where your configuration will be saved, we'll use `./my-config` here. First, run the menu-driven setup program to configure your accounts ```sh docker run -ti -v ./my-config:/config -v ./my-data:/data -ti ghcr.io/joeyates/imap-backup:latest \ --dns 8.8.8.8 \ imap-backup setup -c /config/imap-backup.json ``` Then, run the backup ```sh docker run -v ./my-config:/config -v ./my-data:/data -ti ghcr.io/joeyates/imap-backup:latest \ --dns 8.8.8.8 \ imap-backup backup -c /config/imap-backup.json ```
Homebrew (macOS) ![Homebrew installs](https://img.shields.io/homebrew/installs/dm/imap-backup?label=Homebrew%20installs) If you have [Homebrew](https://brew.sh/), do this: ```sh brew install imap-backup ```
As a Ruby Gem * [Rubygem] ```sh gem install imap-backup --no-document ``` If that doesn't work, see the [detailed installation instructions](/docs/installation/rubygem.md). [Rubygem]: https://rubygems.org/gems/imap-backup "Ruby gem at rubygems.org"
From Source Code If you want to use imap-backup directly from the source code, see [here](/docs/installation/source.md).

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. See this blog post about using imap-backup with email-oauth2-proxy.

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

Performance

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

These are activated via two settings:

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

See the Developer Documentation.