Backup, restore and migrate email accounts.
brew install imap-backup # for macOS
gem install imap-backup --no-document # for Linux
imap-backup setup
imap-backup
There are two types of backups:
See below for a full list of commands.
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
docker run \
--volume ./my-data:/data \
--dns 8.8.8.8 \
ghcr.io/joeyates/imap-backup:latest \
imap-backup single backup \
--email me@example.com \
--password mysecret \
--server imap.example.com \
--path /data/me_example.com
Podman will work exactly the same.
Notes:
--user $(id -u):$(id -g) so that the files
created by the container are owned by you and not by root,--password-environment-variable=VARIABLE_NAME or
--password-file=FILE option to avoid having your password in
the command line history:docker run --env THE_PASSWORD=$THE_PASSWORD \
... \
imap-backup single backup \
--password-environment-variable=THE_PASSWORD \
...
or
docker run \
... \
imap-backup single backup \
--password-file=/data/password.txt \
...
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
docker run \
--volume ./my-config:/config \
--volume ./my-data:/data \
--dns 8.8.8.8 \
--tty \
--interactive \
ghcr.io/joeyates/imap-backup:latest \
imap-backup setup \
--config /config/imap-backup.json
Then, run the backup
docker run \
--volume ./my-config:/config \
--volume ./my-data:/data \
--dns 8.8.8.8 \
ghcr.io/joeyates/imap-backup:latest \
imap-backup backup \
--config /config/imap-backup.json
gem install imap-backup --no-document
If that doesn't work, see the detailed installation instructions.
If you want to use imap-backup directly from the source code, see here.
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).
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.
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.
backupcopylocal accountslocal checklocal folderslocal listlocal showremote foldersrestoresetupsingle backuputils export-to-thunderbirdutils ignore-historyFor a full list of available commands, run
imap-backup help
For more information about a command, run
imap-backup help COMMAND
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.
If you have problems:
imap-backup with the -v or --verbose parameter.See the Developer Documentation.
318 followers · starred Jan 2022
122 followers · starred Sep 2025
1,493 followers · starred Jun 2023
389 followers · starred Jan 2022
Backup, restore and migrate email accounts.
brew install imap-backup # for macOS
gem install imap-backup --no-document # for Linux
imap-backup setup
imap-backup
There are two types of backups:
See below for a full list of commands.
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
docker run \
--volume ./my-data:/data \
--dns 8.8.8.8 \
ghcr.io/joeyates/imap-backup:latest \
imap-backup single backup \
--email me@example.com \
--password mysecret \
--server imap.example.com \
--path /data/me_example.com
Podman will work exactly the same.
Notes:
--user $(id -u):$(id -g) so that the files
created by the container are owned by you and not by root,--password-environment-variable=VARIABLE_NAME or
--password-file=FILE option to avoid having your password in
the command line history:docker run --env THE_PASSWORD=$THE_PASSWORD \
... \
imap-backup single backup \
--password-environment-variable=THE_PASSWORD \
...
or
docker run \
... \
imap-backup single backup \
--password-file=/data/password.txt \
...
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
docker run \
--volume ./my-config:/config \
--volume ./my-data:/data \
--dns 8.8.8.8 \
--tty \
--interactive \
ghcr.io/joeyates/imap-backup:latest \
imap-backup setup \
--config /config/imap-backup.json
Then, run the backup
docker run \
--volume ./my-config:/config \
--volume ./my-data:/data \
--dns 8.8.8.8 \
ghcr.io/joeyates/imap-backup:latest \
imap-backup backup \
--config /config/imap-backup.json
gem install imap-backup --no-document
If that doesn't work, see the detailed installation instructions.
If you want to use imap-backup directly from the source code, see here.
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).
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.
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.
backupcopylocal accountslocal checklocal folderslocal listlocal showremote foldersrestoresetupsingle backuputils export-to-thunderbirdutils ignore-historyFor a full list of available commands, run
imap-backup help
For more information about a command, run
imap-backup help COMMAND
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.
If you have problems:
imap-backup with the -v or --verbose parameter.See the Developer Documentation.
318 followers · starred Jan 2022
122 followers · starred Sep 2025
1,493 followers · starred Jun 2023
389 followers · starred Jan 2022