If you find yourself in a position where you need to sync all emails from one account to another, then you can use the
imapsync command-line tool to bulk copy, or move everything for you.
Step 1 – Get
You need to get the
imapsync tool running locally.
It can be found here https://github.com/imapsync/imapsync
Alternatively, if you are using a Mac and have homebrew installed, then you’re in luck!
brew install imapsync and you’re ready.
Step 2 – Enable
imap on the accounts
imap is often disabled on the email server. We will explore Gmail in this case to test a sync.
In Gmail, under Settings, find
Forwarding and POP/IMAP and make sure that imap is enabled.
Also make sure that
Auto-Expunge is off, and select
Immediately delete the message forever. Make sure that
Folder size limits are not set.
Step 3 – Configure your account creds
You will need the username and password for each account, so have them to hand!
Step 4 – Run the command!
You can now run the tool to transfer all emails from
Sync from host1 to host2 and delete after success on host1
This option will allow you to automatically sync everything in source_account (
host1) to destination_acount (
host2) and on successful migration of email, it will delete the email/s in the source_account.
This option is great if you are migrating from 1 account to another:
Sync from host1 to host2 without deleting anything
If you don’t want to delete any email/s in your source_account (
host1) after successful email transfers, then you can simply leave out the
--delete1 flag, as follows: