IMAP Server How to Backup, Move, and Restore Emails

Oct 31, 2022

Table of Contents

Related to:: Server Management - Emails - Imap

If you are moving or backing up email accounts, you may find out that it’s not a simple process.

Fortunately, we can use a great and simple tool to help us in this task.

The makes it easy to download a copy of emails from an IMAP server and, if needed, restore it on another server.

It’s a command line tool, and it can be used to back up one or multiple accounts at a time.


Install the tool and use the imap-backup setup command to add all the accounts you need to backup.

All the setup information is saved on a JSON file located at ~/.imap-backup/config.json.


If I need to work with multiple accounts, I would rather work on that file than set up every account using the CLI.


Now, the backup part is very simple, you just need to run imap-backup backup and wait for it to finish.

It will download all emails of the configured accounts to the ~/.imap-backup/ directory. You can change the destination directory on the setup part if you want.


When the backup is done, you can change the server address with the setup command or on the config file, run the imap-backup restore, and wait.

Everything will be taken care of, and the messages will be set up on the new accounts.


If you need to change the folder names or delete some files, you can go to the account folder and change the INBOX.something.imap and INBOX.something.mbox to some other*.

When you make this change, the folder is restored to a folder with the new name.

This can be useful if you want to merge 2 accounts.

Graph View