Download Version 1.04, Updated 18 June 2009
    IMAPCopy-Win32   IMAPCopy-Linux (compiled under Fedora Core 9 with FreePascal 2.2.4)
    IMAPCopy-Source

IMAPCopy is a small command line tool to copy messages for multiple users from one imap server to another. I wrote the program to migrate messages from a linux box to exchange but it works with other imap implementations as well. The tool is designed for one time migrations, it does not check if a mail already exists on the target server.

It is written in pascal and can be compiled with freepascal or delphi 3.

2009/07/18: Update

In case the source server returns an invalid timezone in internaldate, this can be translated to a valid one. Stefan had a server that returned "14-Jul-1999 23:56:10 UC", the "UC" can be translated via a new cfg option. See ImapCopy.cfg for details.


2006/04/20: Update

Some Hints from Ciprian about the problem with the \Recent flag
If you do not specify a given list of flags to be copied thus resorting to "copy all flags" you are strongly advised to use DenyFlags for the "\Recent" flag. (This is included in the default config file) If the mailbox you are trying to copy has some messages marked by the server "\Recent" this flag can not be carried over (as per RFC). Not excluding "\Recent" may even result in imapcopy runs that fail for the first time but work for the next attempt(s).

2005/04/10: Update

2005/02/25: Update

2004/11/04: Update

2004/08/20: Update

2004/03/31: Update

2003/09/13: Update

2003/09/13: Update

2003/07/15: Source Update, can now be compiled with FreePascal 1.0.10 and 1.1

2002/01/26: Update, Problems with Lotus Notes as Source Server

2001/10/08: Update, INBOX was created as INBOX.INBOX if source and destination-servers both supports NAMESPACE

2001/10/09: Update, INBOX.INBOX again if source has no NAMESPACE and destination has NAMESPACE

IMAPCopy was tested with the following IMAP-Servers:
 
 
Server Platform Version as Source as Destination Comments
Argosoft Mail Server Pro

1.8.7.5
Yes

Reported by Rui, he migrated about 3000 users to Exchange 2003
Binc



Yes
Reported by Mike
Citadel
Linux
6.4.0
Yes
Yes
reported by Art
Citadel
Solaris
6.4.0 Yes
Yes
reported by Art
Communigate
Linux
3.5.9
Yes

Reported by Rob
Courier IMAP Linux 1.3.11 Yes Yes no problems found
Courier IMAP Linux(Debian) 3.0.8-3 Yes No Reported by Erik
Citadel
Linux
7.37

Yes
reported by Jim, he migrated about 1,000 users from MS Exchange 2003 SP2 Windows, to Citadel 7.37 Linux.
CommuniGate Pro Server Win2K 3.4.7
Yes no problems found
Cyrus IMAP Linux
2.2.16
Yes
no problems found
Cyrus IMAP


Yes
Matthieu migrated from Imail to Cyrus, he had to disable the \Seen-Flag in the config file
Cyrus IMAP Linux

Yes

no problems found (thanks Justin)
Cyrus IMAP Linux
2.2.8
Yes
Reported by Rob
David (Tobit) Win
10.00.a
Yes
Yes
Works, if used as a source, imapcopy 1.04 may be required in case the destination server rejects APPEND. (As seen on notes 8.5)
Dovecot Linux
1.0.15
Yes
Yes

eXtremail
Linux


Yes
reported by Ben Havens, he migrated from Mercury Win32 to eXtremail on Linux
Groupwise
NetWare
5.5
Yes

Groupwise may return one digit days that are not supported by all target servers, imapcopy as of version 0.98 corrects such dates (thanks Chris)
IMail

8.05
Yes

reported by John
IMail

6.05
Yes

reported by Scot
Icewarp Merak Mail Server
8.9.x

Yes
reported by Scot
Lotus CCMail Imap

8.5
Yes

reported by Jason
Lotus Domino Linux
5.0.8
Yes
Yes
Date support in APPEND dosent seem to work. Notes sets wrong dates, i.e. "03-Aug-2001 10:37:14 +0200" is interpreted as "24-May-1945 00:00:00 +0000". Currently i dont know how to set the correct date using notes on linux as a destination.
Lotus Domino Win2K
6.5
Yes
Yes
no problems found (needs imapcopy 0.98 or above)
Lotus Domino Win
8.5
Yes
Yes

Mercury Mailserver Win2K 3.32
Yes
Yes no problems found
Mercury Mailserver WinXP 4
Yes
No Reported by Esben
Microsoft Exchange Win2K 5.5 Yes Yes no problems found
Microsoft Exchange Win 2003 2003 Yes
Yes Reported by Esben and Jim, Hint: Exchange has default settings to limit the max size of a message, you may need to adjust these
Netscpe Messaging Server

4.17
Yes

reported by Benjamin

UW-IMAP

Yes

reported by Derek
UW.IMAP Linux (Debian) 7:2002edebian1-5
Yes Reported by Erik
hMailserver Windows XP, Windows 2003 SBS 5.3.3-B1879 Yes Yes reported by Daniel (1.06)

HOW TO USE IT

First edit the configuration file (ImapCopy.cfg) and adjust the source and destinationserver. Add the source and destination users and passwords. The following sample copys the users "foo" and "bar" from server source.imap.com port 143 to server dest.imap.com port 145. Passwords for foo are "foosrcpw" and "foodestpw", for bar "barsrcpw" and "bardstpw". The folders "Trash", "Sent" and "Sent Objects" will not be copied.

SourceServer source.imap.com
SourcePort 143
DestServer dest.imap.com
DestPort 145

#CreateEmptyFolders

skipfolder INBOX.Trash
skipfolder INBOX.Sent
skipfolder "INBOX.Sent Objects"

#       SourceUser SourcePassword   DestinationUser DestinationPassword
Copy    "foo"       "foosrcpw"         "foo"          "foodestpw"
Copy    "bar"       "barsrcpw"         "bar"          "bardestpw"

Now verify that all users and passwords are correct:

imapcopy -t

You will get:

P:\LIB\TOOLS\ImapCopy>imapcopy -t
Login on sourceserver as foo OK
Login on destinationserver as foo OK
Getting folderlist on sourceserver OK, found 16 folder
Login on sourceserver as bar OK
Login on destinationserver as bar OK
Getting folderlist on sourceserver OK, found 122 folder

2 User processed, 0 Messages copied, 0 Error(s)
0 Folder(s) created, 0 Folder create errors, 0 Folder not copied

You can also show some information about the used servers:

imapcopy -i

Server-Info          : Courier-IMAP ready. Copyright 1998-2001 Double Precision, Inc.  See COPYING for distribution information.
Capabilities         : IMAP4REV1 CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD =REFERENCES SORT
Personal Namespace   : INBOX
Folder sperator      : .
other Users Namespace:
Public Namespace     : shared
Folders to copy      : ALL
Skip this folders    : NONE

Destinationserver:
==================
Server-Info          : Domino IMAP4 Server Release 5.0.8  ready Sun, 12 Aug 2001 17:09:36 +0200
Capabilities         : IMAP4REV1 AUTH=LOGIN AUTH-LOGIN LITERAL+
Personal Namespace   :
Folder sperator      : \
other Users Namespace:
Public Namespace     :

Currently all private folders and messages are copyed. Public and other users folders will be skipped. You can specify additional folders that will not be copied (with skipfolder in configfile or -S on commandline). You can also specify folders that will be copied (with copyfolder in configfile or -O on commandline).

Before starting a full copy you should do a copy to a testuser with the commandline-option -1. This will copy only the first message from each folder. After that you can verify that folders can be created and messages can be copied in general.

Note: Some users reported problems regarding flags. With some servers the flags from the source server are not compatible with the supported flags on the destination server. If you have problems copying mails, please try to enable the AllowFlags directive in the config file.

 

FEATURES

MISSING

BUGS

LICENSE

GNU general public license

... and drop me a note in case it works (or if it will not work)

Armin Diehl

Last update: 2011/06/18 armin Impressum(to satisfy german law)