Download Version 1.03, Updated 20 April 2006
IMAPCopy-Win32 IMAPCopy-Linux (compiled under Fedora Core 4 with FreePascal 2.0.2)
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.
It is written in pascal and can be compiled with freepascal or delphi 3.
- Added a config directive to filter out unwanted flags (Thanks Ciprian).
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).
- Fixed a memory leak in the folder list (Thanks Christiaan for reporting this).
- Applied patch from Christiaan den Besten to support skipping specified folders and to supress INBOX.INBOX. In case the INBOX.INBOX removement will cause some trouble, drop me a note and i will add a new switch for that.
- Compiled linux and win32 version with FreePascal 1.9.8 (debug symbols and -gl)
- parts of the last server response was added to the destination mail
- fixed cr/lf problem, imapcopy assumed that lines always end with cr/lf (thanks Ciprian for figuring out that bug)
- Errors reported for some servers after append command
- Added -X to copy all messages to INBOX
- A blank line at the end of ImapCopy.cfg is no longer needed
- Tabs are supported in ImapCopy.cfg
- A list of supported flags for the destination server can be set in config file
- -e to create empty folders are supported now
- Added option -0 to only copy the folder structure without copy any message
- Added option -s to subscribe all folders (while copying with or without -0)
- changed inet.pp to support RedHat 9 also
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|
|Courier IMAP||Linux||1.3.11||Yes||Yes||no problems found|
|Courier IMAP||Linux(Debian)||3.0.8-3||Yes||No||Reported by Erik|
|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.|
||no problems found (needs imapcopy 0.98 or above)
|CommuniGate Pro Server||Win2K||3.4.7||Yes||no problems found|
||Yes||no problems found|
||No||Reported by Esben|
|Microsoft Exchange||Win2K||5.5||Yes||Yes||no problems found|
|Microsoft Exchange||Win 2003||2003||Yes||Reported by Esben, Hint: Exchange has default settings to limit the max size of a message, you may need to adjust these|
|Cyrus IMAP||Linux||2.2.16||Yes||no problems found|
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|
||reported by Ben Havens, he migrated from Mercury Win32 to eXtremail on Linux
||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)
||reported by Derek
|UW.IMAP||Linux (Debian)||7:2002edebian1-5||Yes||Reported by Erik|
|?||126.96.36.199||Yes||Reported by Rui, he migrated about 3000 users to Exchange 2003|
|Dovecot||Yes||reported by Derek|
Lotus CCMail Imap
||reported by Jason
||reported by Mike|
|Communigate||Linux||3.5.9||Yes||Reported by Rob|
|Linux||6.40||Yes||Yes||reported by Art|
|Solaris||6.40||Yes||Yes||reported by Art|
|?||8.05||Yes||reported by John|
Netscpe Messaging Server
|?||4.17||Yes||reported by Benjamin|
skipfolder "INBOX.Sent Objects"
SourcePassword DestinationUser DestinationPassword
Copy "foo" "foosrcpw" "foo" "foodestpw"
Copy "bar" "barsrcpw" "bar" "bardestpw"
Now verify that all users and passwords are correct:
You will get:
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:
: 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
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.
... and drop me a note in case it works (or if it will not work)
Last update: 2006/04/21 armin Impressum(to satisfy german law)