How to migrate emails from one server to another using IMAPSync - ­čĆć Managed Server


July 9 2024

How to migrate emails from one server to another using IMAPSync

IMAPSync: powerful and flexible tool for migrating email accounts between IMAP servers, ensuring data security and integrity.


The migration of email accounts is an operation that is often necessary for various reasons: changing service provider, updating or replacing the server, optimizing performance, or simply to centralize email management. Whatever the reason, moving email data from one server to another requires a meticulous approach and reliable tools to ensure that no information is lost. One of the most effective tools to do this is IMAPSync.

Introduction to the IMAP Protocol

IMAP (Internet Message Access Protocol) is a protocol used by email clients to access messages on a mail server. Unlike POP3 (Post Office Protocol version 3), which downloads emails to the local device and generally removes them from the server, IMAP allows you to manage and synchronize emails directly on the server. This means that changes made on one device are reflected on all other connected devices, keeping email in sync and accessible from multiple access points.

Differences between IMAP and POP3

Let's now see the main differences between the POP3 protocol (now obsolete but always present) and the IMAP protocol.


    • Synchronization of messages between server and client.
    • Simultaneous access from multiple devices.
    • Messages remain on the server until they are manually deleted.
    • Support for folders on the server.


    • Messages are downloaded and usually deleted from the server.
    • Access to messages limited to the device on which they were downloaded.
    • Does not support message synchronization between devices.
    • Simple and lightweight, but with limited functionality compared to IMAP.

Introduction to IMAPSync

IMAPSync is an open-source tool developed to facilitate the migration of email boxes from one IMAP server to another. It was created by Gilles Lamiral and represents a robust and flexible solution for performing secure and complete email transfers. Its main function is to synchronize the contents of mailboxes between two IMAP servers, keeping the folder structure and messages intact.

Story and Author

Gilles Lamiral developed IMAPSync to address the need for a reliable tool to migrate emails without data loss. The first version was released in 2001 and, since then, the software has been continuously improved thanks to community feedback and constant updates from the author. This continuous development has allowed IMAPSync to stay abreast of new technologies and the needs of its users, making it one of the most popular tools in its field.

Lamiral designed IMAPSync with the goal of creating a tool that was not only effective, but also simple to use and highly configurable. His dedication and active interaction with the user community has allowed us to introduce numerous advanced features, improving the reliability and efficiency of the migration process.

Features and License

IMAPSync is available under the GNU GPL license, which means it can be downloaded, used and modified for free. This has driven widespread adoption and contribution from the open-source community, allowing IMAPSync to constantly evolve and adapt to the ever-changing needs of the email world.

The main features of IMAPSync include:

  • Incremental Synchronization: Allows you to perform incremental synchronizations to transfer only new messages, saving time and resources.
  • Preservation of Dates: Preserves the original dates of messages, ensuring that all temporal information is preserved during transfer.
  • Multiple Authentication Support: Compatible with multiple authentication methods, including plain login, CRAM-MD5 and OAuth2.
  • Folder Mapping: Attempts to automatically map special folders between the two servers, such as Inbox, Sent Items, Drafts, and Trash.
  • Advanced Configurability: Wide range of configuration options to customize the migration process based on your specific needs.

For more information and to download IMAPSync, visit the official website:

Using IMAPSync, system administrators can manage complex migrations easily and efficiently, minimizing the risk of data loss and ensuring a smooth transition between mail servers.

Using IMAPSync to Migrate Emails


Before you start migrating with IMAPSync, make sure you have:

  • Access to source and destination servers.
  • Valid credentials for the mailboxes to be migrated.
  • IMAP enabled on both servers.
  • A Unix-like (Linux, macOS) or Windows environment with IMAPSync installed.

Installing IMAPSync

On a Linux system, installing IMAPSync can be done via the package manager of the respective Linux distributions, or by compiling the software from source:

sudo apt-get install imapsync

sudo yum install imapsync

sudo dnf install imapsync

If you prefer to compile from source:

git clone
cd imapsync
sudo make install

Migration Example

To migrate a mailbox from a source server ( to a target server (, use the following command:

imapsync \
--host1 --user1 utente_sorgente --password1 password_sorgente \
--host2 --user2 utente_destinazione --password2 password_destinazione

Useful Options

  • --dry: Performs a migration simulation without actually transferring messages.
  • --noauthmd5: Disable MD5 authentication if not supported by the server.
  • --automap: Attempts to automatically map special folders (such as Inbox, Sent Items) between the two servers.
  • --syncinternaldates: Keeps the original dates of messages.

Migration Verification

After running IMAPSync, it is essential to do a thorough check to ensure that all emails have been successfully migrated. Follow these steps for complete verification:

  1. Access the Mailbox on the Destination Server:
    • Use an email client or the destination server's web interface to access the migrated mailbox.
  2. Check the Folder Structure:
    • Make sure that all folders on the source server have been successfully replicated to the destination server. This includes standard folders such as Inbox, Sent Items, Drafts, Trash, and any custom folders you create.
  3. Check the Messages:
    • Open several emails in each folder to make sure the contents are intact and that there are no missing or corrupt messages.
    • Verify that emails maintain the same date and time they were originally sent and received.
  4. Check the Attachments:
    • Make sure all attachments are present and accessible in emails. Try opening some attachments to confirm that they were not damaged during the migration.
  5. Synchronization of Special Folders:
    • Verify that special folders (such as Sent Items, Drafts, and Trash) are correctly synchronized and mapped on the destination server.
  6. Test Sending and Receiving Emails:
    • Send a test email from the migrated mailbox to another email to confirm that the destination server can send messages successfully.
    • Receive a test email in the migrated inbox to verify that it can also receive messages.
  7. Comparison of Totals:
    • Compare the total number of emails and total mailbox size between the source and destination servers to ensure they are identical.
  8. IMAPSync logs:
    • Review the logs generated by IMAPSync to identify any errors or warnings that may require attention.

Conducting a thorough post-migration check is essential to ensure that all emails and related structures have been transferred correctly and that there has been no data loss.


Email inbox migration may seem like a complex operation, but with the use of proper tools like IMAPSync, the process becomes manageable and secure. IMAPSync is a very powerful and versatile tool, which can be used via shell scripting such as Bash to automate operations and organize massive migrations of thousands of mailboxes in a completely automated way. Thanks to its reliability and flexibility, IMAPSync is an excellent solution for anyone faced with transferring emails between IMAP servers. Be sure to follow the instructions carefully and test the migration to ensure a smooth experience.

If you are looking for an outsourced mailbox migration service, our company offers professional solutions at the best prices on the market. Contact us today to find out how we can assist you in migrating your email inboxes quickly, securely and seamlessly. Trust our experts for an efficient and personalized service.

Do you have doubts? Don't know where to start? Contact us!

We have all the answers to your questions to help you make the right choice.

Chat with us

Chat directly with our presales support.


Contact us by phone during office hours 9:30 - 19:30

Contact us online

Open a request directly in the contact area.


Managed Server Srl is a leading Italian player in providing advanced GNU/Linux system solutions oriented towards high performance. With a low-cost and predictable subscription model, we ensure that our customers have access to advanced technologies in hosting, dedicated servers and cloud services. In addition to this, we offer systems consultancy on Linux systems and specialized maintenance in DBMS, IT Security, Cloud and much more. We stand out for our expertise in hosting leading Open Source CMS such as WordPress, WooCommerce, Drupal, Prestashop, Joomla, OpenCart and Magento, supported by a high-level support and consultancy service suitable for Public Administration, SMEs and any size.

Red Hat, Inc. owns the rights to Red Hat┬«, RHEL┬«, RedHat Linux┬«, and CentOS┬«; AlmaLinuxÔäó is a trademark of AlmaLinux OS Foundation; Rocky Linux┬« is a registered trademark of the Rocky Linux Foundation; SUSE┬« is a registered trademark of SUSE LLC; Canonical Ltd. owns the rights to Ubuntu┬«; Software in the Public Interest, Inc. holds the rights to Debian┬«; Linus Torvalds holds the rights to Linux┬«; FreeBSD┬« is a registered trademark of The FreeBSD Foundation; NetBSD┬« is a registered trademark of The NetBSD Foundation; OpenBSD┬« is a registered trademark of Theo de Raadt. Oracle Corporation owns the rights to Oracle┬«, MySQL┬«, and MyRocks┬«; Percona┬« is a registered trademark of Percona LLC; MariaDB┬« is a registered trademark of MariaDB Corporation Ab; REDIS┬« is a registered trademark of Redis Labs Ltd. F5 Networks, Inc. owns the rights to NGINX┬« and NGINX Plus┬«; Varnish┬« is a registered trademark of Varnish Software AB. Adobe Inc. holds the rights to Magento┬«; PrestaShop┬« is a registered trademark of PrestaShop SA; OpenCart┬« is a registered trademark of OpenCart Limited. Automattic Inc. owns the rights to WordPress┬«, WooCommerce┬«, and JetPack┬«; Open Source Matters, Inc. owns the rights to Joomla┬«; Dries Buytaert holds the rights to Drupal┬«. Amazon Web Services, Inc. holds the rights to AWS┬«; Google LLC holds the rights to Google CloudÔäó and ChromeÔäó; Microsoft Corporation holds the rights to Microsoft┬«, Azure┬«, and Internet Explorer┬«; Mozilla Foundation owns the rights to Firefox┬«. Apache┬« is a registered trademark of The Apache Software Foundation; PHP┬« is a registered trademark of the PHP Group. CloudFlare┬« is a registered trademark of Cloudflare, Inc.; NETSCOUT┬« is a registered trademark of NETSCOUT Systems Inc.; ElasticSearch┬«, LogStash┬«, and Kibana┬« are registered trademarks of Elastic NV Hetzner Online GmbH owns the rights to Hetzner┬«; OVHcloud is a registered trademark of OVH Groupe SAS; cPanel┬«, LLC owns the rights to cPanel┬«; Plesk┬« is a registered trademark of Plesk International GmbH; Facebook, Inc. owns the rights to Facebook┬«. This site is not affiliated, sponsored or otherwise associated with any of the entities mentioned above and does not represent any of these entities in any way. All rights to the brands and product names mentioned are the property of their respective copyright holders. Any other trademarks mentioned belong to their registrants. MANAGED SERVER┬« is a trademark registered at European level by MANAGED SERVER SRL, Via Enzo Ferrari, 9, 62012 Civitanova Marche (MC), Italy.

Back to top