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, were being duplicated in the mirror server. This was due to invalid headers and 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 differences with mnIMAPSync and the other tools available 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.
Follow the site instructions to download and install the Jave Runtime Environment.
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 downloaded the Zip distribution, extract the package contents to a directory using your favorite 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 in 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.
java -jar mnIMAPSync.jar --host1 imap.gmail.com --port1 993 --user1 email@example.com --password1 mypassword --ssl1 --host2 my.server.com --port2 143 --user2 firstname.lastname@example.org --password2 backuppassword --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.