Knowledge Base

How Can We Help?

What is the process for migrating emails using IMAP Copy?

You are here:

In this tutorial, we will learn about the process of migrating emails using IMAP Copy.

What is IMAP Copy?

IMAP Copy is a technique employed in the migration of websites. To comprehend what IMAP Copy entails, we must first familiarize ourselves with the steps involved in website migration. Let us examine an overview of website migration.

Steps involved in website migration

Many websites utilize control panels for managing their operations. Control panels facilitate easy website management for owners, even if they lack technical expertise or skill in navigating through command line interfaces. Popular control panels in the web hosting industry include cPanel, Plesk, and DirectAdmin.

The steps involved in migrating a website vary depending on whether or not a control panel was used. Most control panels provide their own utilities for seamless website migration. These utilities typically involve the following steps:

1) Perform a complete backup of the website.
2) Transfer the backup to the new servers.
3) Restore the backup on the new server.

In the case of a website without a control panel, the migration process is distinct. Manual migration of the website is necessary and involves a few additional steps, outlined below:

1) Back up website files, databases, and emails individually.
2) Transfer the backups, typically via FTP.
3) Create databases on the new server and restore the backups.

Notice that emails must be migrated manually. IMAP Copy is used to transfer emails from the old server to the new server. Let us explore the procedure for migrating emails using IMAP Copy.


IMAP Copy is a utility that enables the recursive copying of email messages and folders from one IMAP server to another. This functionality allows the transfer of mailboxes and messages between servers. It is important to note that using IMAP Copy requires an email account that supports IMAP over POP3. Below, we compare and contrast IMAP and POP3.


IMAP stands for Internet Message Access Protocol. It is used to access emails on a webserver from a local mail client. This protocol is recommended if you want to access your emails from multiple devices such as mobile phones, personal computers, and office computers. With IMAP, emails are stored on the server, enabling access from any location. However, saving a large number of emails can consume significant disk space on the server.


POP3, which stands for Post Office Protocol, is another email access protocol. Unlike IMAP, POP3 does not download and store emails from the server onto your local device.


How does IMAP Copy function?

IMAP Copy, as previously mentioned, is a tool used to copy a user’s email messages from one web server to another. It is a Perl program specifically designed to work with IMAP servers. The program begins by logging into the old server (where the emails are to be copied from) using the account’s username and password. It then compiles a list of mailboxes and their corresponding email messages. Next, the program logs into the new server (where the emails will be copied to) using the username and password of the new server. It proceeds to copy the mailboxes and messages to the new server. The structure of the mailboxes on the old server is replicated on the new server, ensuring that the email account’s original structure is preserved.

IMAP Copy also preserves flag categories such as “Seen” and “Deleted,” as well as the dates of the emails.


Steps involved in IMAP Copy

1) Install IMAP Copy.

For CentOS systems, download imapcopy.tar.gz.

Extract the contents of the downloaded file:

# tar -xvf imapcopy.tar.gz

Navigate to the “imapcopy” directory:

# cd imapcopy

2) Specify the source and destination server details.

To do this, edit the configuration file, “ImapCopy.cfg,” and enter the necessary details. A sample configuration is provided below:


SourcePort 143


DestPort 145


skipfolder INBOX.Trash

skipfolder INBOX.Sent

skipfolder “INBOX.Sent Objects”

# SourceUser SourcePassword DestinationUser DestinationPassword

Copy “usr1” “usr1srcpw” “usr1” “usr1destnpw”

Copy “usr2” “usr2srcpw” “usr2” “usr2destnpw”

Note: This sample configuration copies users “usr1” and “usr2” from “” (port 143) to “” (port 145). The password for “usr1” on the source server is “usr1srcpw,” and on the destination server, it is “usr1destnpw.” Similarly, the password for “usr2” on the source server is “usr2srcpw,” and on the destination server, it is “usr2destnpw.”

Prior to executing IMAP Copy, you can test the configuration file to ensure that all inputted data is valid. To do so, run the following command:

3) Test the configuration file.

# imapcopy -t

For information about the servlets used, run the following command:

# imapcopy -l

4) Initiate the migration process.

To perform the operation, execute the following command:

# imapcopy

If further assistance is required, please contact our support department.

A Step-by-Step Guide on Transferring Emails using IMAP Copy

Leave a Comment