The imapsync application to copy IMAP mail between IMAP mail servers


Information about imapsync

The application is available for unix systems and Windows. View the man page for detailed information.
Ubuntu systems can install imapsync via the package manager.
imapsync can be installed on any machine (not necessarily the imap servers).
imapsync can copy mail folders containing sub-folders and files

Imapsync moves mail for an account from one IMAP mail server to another IMAP mail server.
It will only move files with mail headers. If mail was stored in a non-mail folder it will be moved as well.

The man page for imapsync shows it successful for the following servers (among others):
     - Dovecot, 0.99.14, 0.99.14-8.fc4, 1.0-0.beta2.7,
       1.0.0 [dest/source] (LGPL) (
       Exchange 2010 RTM (Release to Manufacturing) [host2],
       Exchange 2010 SP1 RU2[host2]

Installing imapsync

Ubuntu installs imapsync from Synaptic Package Manager.

$ which imapsync
    /usr/bin$ ls -la imapsync
    -rwxr-xr-x 1 root root 119254 2010-07-08 08:14 imapsync 

It is in the imapsync package.

    $ dpkg-query --search /usr/bin/imapsync
    imapsync: /usr/bin/imapsync

Windows requires the imapsync.exe file.

Basic imapsync command

    /usr/bin$ imapsync --host1 --user1  --passfile1 /etc/secret1 --host2  --user2 --passfile2 /etc/secret2
Where the secret1 file holds the imap user password for the account on server1.

    /usr/bin$ imapsync --noauthmd5 --ssl1 --host1  --user1 theuerid --password1 'MyPw!4u' --ssl2 --host2  --delete2 --folderrec  ZDnet --user2 theuserid --password2 PlainPW
In the above example the password "MyPw!4u" contains a ! and must be surrounded by single quotes. The "PlainPW" password has no special characters, so does not require quotes. This command shows the passwords as entered and hence not secure if others are present.

    /usr/bin$ imapsync --noauthmd5 --ssl1 --host1 --folder INBOX --user1 gchopiak --passfile1 /home/gboerke/secret1 --host2 --folder INBOX --user2 nexus\\gchopiak --passfile2 ~/secret2
Where only one folder i.e. INBOX is transferred.

    /usr/bin$ imapsync --noauthmd5 --ssl1 --host1 --user1 jwwong --passfile1 ~/Desktop/secret1 --sep1 / --prefix1 "" --syncinternaldates --ssl2 --host2 --user2 nexus\\jwwong --passfile2 ~/Desktop/secret2
The above command uses separators. This may be required if the "imapsync" fails and reports this:
... ignored many folders
Warning: ignoring folder WindowsDocs/upstair/citr/01-02 ec because it is not selectable
Warning: ignoring folder correspondence/memo because it is not selectable
No NAMESPACE capability in imap server
Give the separator character with the --sep1 option 

-- Main.gboerke - 22 Mar 2012

Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r4 - 2013-03-06 - GordBoerke
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2023 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback