Home » , » Migrate Linux Qmail to Exchange 2010 through Imapsync

Migrate Linux Qmail to Exchange 2010 through Imapsync

Written By mediana saputra on Thursday, 10 January 2013 | 05:33

This is good utility to migrate mailboxes from QMail based email servers to Exchange mail servers.

imapsync software is a command line tool allowing incremental and recursive IMAP transfers from one mailbox to another, both anywhere on the internet or in your local network. "Incremental" means you can stop the transfer at any time and restart it later efficiently. "Recursive" means all folders hierarchy can be copied. "Command line" means it's not a graphical tool, imapsync on Windows has to be run in a DOS box (cmd.exe) or from a batch file.

imapsync is useful for imap account migration or imap account backup.

imapsync is not adequate for maintaining two active imap accounts in synchronization where the user plays independently on both sides. Use offlineimap (written by John Goerzen) or mbsync (written by Michael R. Elkins) for 2 ways synchronizations.

Alternatives to imapsync are listed in the Similar softwares section.
Latest release is imapsync 1.518

Written on Monday, 24-Dec-2012 01:28:32 CET
See ChangeLog to know what's new in details since 2001.
New features or bugfixes since previous releases:
Version 1.518
Bug fix: When identtifying with header, change tabulations to spaces (Gmail bug with "Received:" header on multilines).
Bug fix: Bugfix. Automatic --nocheckmessageexists when --noabletosearch is set.

Simple transfer on Windows

See imapsync_example.bat batch file example that you can easily adapt with your parameters.
Massive transfers (many mailboxes)

In order to migrate many mailboxes a good way is to use a loop over a csv file containing only the data credentials. A example of this file is file.txt, it can be used by the two following command scripts.
On Windows, see sync_loop_windows.bat batch example.
On Unix, see sync_loop_unix.sh example.

imapsync - IMAP synchronization, copy or migration tool. Synchronize mailboxes between two imap servers. Good at IMAP migration.
$Revision: 1.125 $


 imapsync works fine under any Unix OS.
imapsync works fine under Windows 2000 (at least) and ActiveState's 5.8 Perl
 Get imapsync at
 You'll find a compressed tarball called imapsync-x.xx.tgz
where x.xx is the version number. Untar the tarball where
you want :
 tar xzvf  imapsync-x.xx.tgz
 Go into the directory imapsync-x.xx and read the INSTALL
 The freshmeat record is http://freshmeat.net/projects/imapsync/


  imapsync [options]
  imapsync --help
  imapsync [--host1 server1]  [--port1 <num>]
[--user1 <string>] [--passfile1 <string>]
[--host2 server2] [--port2 <num>]
[--user2 <string>] [--passfile2 <string>]
[--folder <string> --folder <string> ...]
[--include <regex>] [--exclude <regex>]
[--prefix2 <string>]
[--sep1 <char>]
[--sep2 <char>]
[--maxsize <int>]
[--maxage <int>]
[--skipheader <regex>]
[--delete] [--expunge]
[--subscribed] [--subscribe]
[--debug] [--debugimap]
[--timeout <int>]
[--version] [--help]


While working on imapsync parameters please run imapsync in dry mode (no modification induced) with the --dry option. Nothing bad can be done this way.

To synchronize the imap account buddy on host imap.src.fr to the imap account max on host imap.dest.fr (the passwords are located in too files /etc/secret1 for buddy, /etc/secret2 for max) :

 imapsync --host1 imap.src.fr  --user1 buddy --passfile1 /etc/secret1 \
--host2 imap.dest.fr --user2 max --passfile2 /etc/secret2
Then, you will have buddy's mailbox updated from max's mailbox.


You can use --password1 instead of --passfile1 to give the password but it is dangerous because any user on your host can see the password by using the 'ps auxwwww' command. Using a variable (like CW$PASSWORD1) is also dangerous because of the 'ps auxwwwwe' command. So, saving the password in a well protected file (600 or rw-------) is the best solution.
imasync is not protected against sniffers on the network so the passwords are in plain text.


imapsync will exit with a 0 status (return code) if everything went good. Otherwise, it exits with a non-zero status.
So if you have a buggy internet connection, you can use this loop in a Bourne shell:
        while ! imapsync ...; do 
echo imapsync not complete


Gilles LAMIRAL lamiral@linux-france.org


Have a special attention on options --subscribed --subscribe --delete --expunge --maxage --maxsize

If you have many mailboxes to migrate think about a little shell program. Write a file called file.csv (for example) containing users and passwords. The separator used in this example is ';'

The file.csv file content is :

user0001;password0001;user0002;password0002 user0011;password0011;user0012;password0012 ...

And the shell program is just :

{ while IFS=';' read u1 p1 u2 p2; do imapsync --user1 CW$u1 --password1 CW$p1 --user2 CW$u2 --password2 CW$p2 ... done ; } < file.csv

Website - 


For More information -
Migrate Linux Qmail to Exchange 2010

Share this article :

Post a Comment

Support : Creating Website | Johny Template | Mas Template
Copyright © 2011. Turorial Grapich Design and Blog Design - All Rights Reserved
Template Created by Creating Website Published by Mas Template
Proudly powered by Blogger