28. Chapter - Migrating Emails with IMAPCopy

If large amounts of emails are to be transferred from an existing email server to the Intra2net system, IMAPCopy is usually the fastest way. IMAPCopy automatically copies the emails from one IMAP server to another, and can process multiple accounts at once.

This means that the existing email server must be accessible via IMAP protocol. For some groupware servers, such as Tobit David or Microsoft Exchange, the IMAP service may need to be activated first.

IMAPCopy is open source and can be downloaded from the following URL:http://ardiehl.de/imapcopy/index.html.

Unpack the program into a separate directory. It is managed by the ImapCopy.cfg file. A suitable sample file is included. Open it with a text editor and edit it. Lines starting with # are comment lines and are ignored by the program.

Customize the following commands in the file:

SourceServer

The DNS name or IP of the source server from which the emails are to be retrieved

SourcePort

The TCP port used to communicate with the IMAP service on the source server. Usually 143.

DestServer

The DNS name or IP of the destination server. The name of the Intra2net system.

DestPort

The TCP port for the IMAP service of the destination server. For the Intra2net system it is always 143.

skipfolder

Folders on the source server that are not to be copied. If necessary, one or more items can be added to prevent deleted emails from being copied. For each folder to be excluded, use a "skipfolder" command in a separate line.

copyfolder

If only certain folders are to be copied, activate this command and specify the folders to be copied in individual "copyfolder"commands. If no "copyfolder" command is specified, all visible folders within INBOX are automatically copied.

DenyFlags

Use the default value "\Recent" because this flag cannot be copied.

Copy

Specify each account to be copied in a "Copy" command and replace the example lines with foo and bar.

The 1. parameter is the user's login on the source server

The 2. parameter is the password of the user on the source server

The 3. parameter is the login of the user on the Intra2net system

The 4. parameter is the password of the user on the Intra2net system

Several copy commands are processed one after the other.

To run IMAPCopy, open a console with cmd and use cd to go to the directory where IMAPCopy was unpacked.

First test the basic configuration by entering imapcopy -t.

The program progress and any error or success messages are displayed on the console. Only if you have opened IMAPCopy as described in a separate console, you can still see these messages after the program has finished.

The program now checks the availability of the source and target server as well as the logins. If errors are displayed, adjust the configuration file and test it again.

Test the folder structure detection by entering imapcopy -0.

The program now tries to import all folders from the source server and create them on the Intra2net system. However, no emails are copied yet. Using the Intra2net system's web groupware, check whether all of the folders have been created correctly. If necessary, adjust the configuration on IMAPCopy.

Now start the actual email transfer by entering imapcopy.