Incremental E-Mail backup and migration using mnIMAPSync
Yet another IMAP syncing tool
Two years ago when I first released mnIMAPSync, there were several mail syncing tools available. The problem with most of them was that when performing incremental E-Mail backups or migrations, some of the e-mails, mostly the ones that didn't conform the RFC (3501), were being duplicated in the mirror server. This was due to invalid headers and an invalid or non-existent message-id.
With no tool available in hand, I had to code one myself that did the job correctly. The main difference between mnIMAPSync and the other available tools is that mnIMAPSync checks several headers for each message and creates a rapid access index so that when the mirror server gets crawled, existing messages won't get duplicated.
Requirements
Java
This tool is coded in java, so you will need a valid JRE. If you don't have Java installed on your system, visit www.java.com/download and download the newest release.
Follow the site instructions to download and install the Jave Runtime Environment.
mnIMAPSync
Next you have to download mnIMAPSync. You can either download the latest release, or the latest source code from Github and compile your jar. To download a precompiled release visit https://github.com/manusa/mnIMAPSync#releases and download the latest.
Once you've downloaded the Zip distribution, extract the package contents to a directory using your favorite compression tool.
Running the program
This is a command-line application, so you will need a terminal/cmd window.
In windows you can use cmd.exe
(Start->Run->cmd.exe)
To use the program you simply have to specify the required command line arguments. You can find a list of these arguments in the program homepage.
For this tutorial, we are going to migrate a GMail account to a regular mail account in a personal server. If you execute the process on a regular basis, each migration will run incrementally and the process will only copy messages and folders that don't exist in the target server.
1java -jar mnIMAPSync.jar \
2 --host1 imap.gmail.com --port1 993 \
3 --user1 myuser@gmail.com --password1 mypassword --ssl1 \
4 --host2 my.server.com --port2 143 \
5 --user2 backupuser@my.server.com --password2 backuppassword \
6 --threads 3 --delete
The above command will sync a source account in gmail to a backup account inmy.server.com.
host1, port1, user1, password1 and ssl1 are the parameters that specify the source server connection and authorization options. In this case we will connect to gmail's imap server using ssl.
host2, port2, user2 and password2 are the parameters that specify the target server connection and authorization options. In this case we are connecting to my.server.com using a regular connection (not ssl encrypted).
threads parameter indicates the number of threads to use. In this case, there will be 3 thread workers, so the program will make 3 connections to the source and target server to run the tasks in parallel.
delete is an optional parameter that indicates if we want to delete folders and messages in the target server that no longer exist in the source server.
Comments in "Incremental E-Mail backup and migration using mnIMAPSync"
https://www.marcnuri.com/file/mnIMAPSync-release-0.0.3-alpha.zip
404 File not found
Download latest release from https://github.com/manusa/mnIMAPSync/releases
https://github.com/manusa/mnIMAPSync/releases/download/v0.0.4/mnimapsync-all.jar
I'll try to update this post/Readme soon to show alternative ways of running (Docker)