Press "Enter" to skip to content

How to copy all e-mails between IMAP servers

In 2022 Google decided to cancel free tier to legacy Google Workspace accounts (i.e., formerly known as GSuite). Due to many complaints by home users who mainly use the service for the domain-hosted e-mail, Google decided to keep free tier for non-business users with some conditions.

I am still using Google-hosted e-mail services but in the mean time I started a transition to other options. I tried self-hosted Synology Mail Plus server which worked great but I would still prefer a profesionally hosted service for e-mail. A useful alternative was Apple that allows domain-hosted e-mails together with my 2TB iCloud+ service.

I transferred all my email to both Synology and Apple just for testing purposes. My mailbox quota is around 40 GB and it took around 2 days (rate limits taken into account) to copy all mails to another server.

I used free imapsync tool, implemented by Gilles Lamiral. He offers paid services to copy/sync emails continuously. His source code repository is well organized and he also prepared a Docker image that anyone can run. So the command I used, was the following:

docker run gilleslamiral/imapsync imapsync \
    --errorsmax 200 \
    --gmail1 \
    --user1 USERNAME_1 \
    --password1 PASS_1 \
    --host2 imap.mail.me.com 
    --ssl2 
    --user2 USERNAME_2 \
    --password2 PASS_2 \

From the command you can observe that Google settings are also encoded by the software and there is no need to define server or other specifics. If someone wants, he can define everything by himself. In this case we would copy emails from a Gmail account to an iCloud account.

As I was briefly using iCloud e-mail services, I used the same command (parameters in reverse) to sync new emails to Gmail. An additional parameter --dry is useful just to check if everything is working as expected. Full documentation is clearly described at the Github repository.

Leave a Reply

Your email address will not be published.

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.