{"id":1313,"date":"2022-09-23T22:51:00","date_gmt":"2022-09-24T04:51:00","guid":{"rendered":"http:\/\/blog.supportpro.com\/?p=1313"},"modified":"2026-03-27T02:51:22","modified_gmt":"2026-03-27T08:51:22","slug":"email-migration","status":"publish","type":"post","link":"https:\/\/www.supportpro.com\/blog\/email-migration\/","title":{"rendered":"Imapsync Email Migration: Tool usage and examples"},"content":{"rendered":"\n<p>Email migration is the process of transferring mailbox data from one email account or server to another. Organizations often perform migrations when switching hosting providers, upgrading mail servers, or consolidating email infrastructure.<\/p>\n\n\n\n<p>One of the most reliable tools for performing email migration on Linux servers is <strong>imapsync<\/strong>. This command-line utility allows administrators to transfer emails between two IMAP servers efficiently. It supports <strong>incremental synchronization<\/strong>, meaning that only new or missing messages are transferred, which helps reduce bandwidth usage and migration time.<\/p>\n\n\n\n<p>Imapsync also preserves message flags and folder structures, ensuring that the migrated mailbox remains identical to the original one.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What is the Imapsync Command?<\/h2>\n\n\n\n<p><strong>Imapsync<\/strong> is a powerful tool designed for transferring email messages between two IMAP servers. It performs a recursive synchronization of all mailbox folders by default.<\/p>\n\n\n\n<p>One of the key advantages of imapsync is that it avoids duplicate transfers. The tool compares messages on both servers based on headers and size. If a message already exists on the destination server, it is skipped.<\/p>\n\n\n\n<p>Additional benefits include:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Incremental synchronization<\/li>\n\n\n\n<li>Preservation of message status (read, unread, deleted)<\/li>\n\n\n\n<li>Reliable operation even with unstable network connections<\/li>\n\n\n\n<li>Ability to pause and resume migrations<\/li>\n<\/ul>\n\n\n\n<p>Because of these features, imapsync is widely used for <strong>server migrations and mailbox transfers<\/strong>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Basic Imapsync Command Usage<\/h2>\n\n\n\n<p>The general syntax of the imapsync command is:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>imapsync &#91;options]<\/code><\/pre>\n\n\n\n<p>Some parameters are mandatory for a successful migration.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Required Parameters<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><div class=\"pcrstb-wrap\"><table class=\"has-fixed-layout\"><thead><tr><th>Option<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td><code>--host1<\/code><\/td><td>Source IMAP server<\/td><\/tr><tr><td><code>--user1<\/code><\/td><td>Source email account<\/td><\/tr><tr><td><code>--password1<\/code><\/td><td>Password for source account<\/td><\/tr><tr><td><code>--host2<\/code><\/td><td>Destination IMAP server<\/td><\/tr><tr><td><code>--user2<\/code><\/td><td>Destination email account<\/td><\/tr><tr><td><code>--password2<\/code><\/td><td>Password for destination account<\/td><\/tr><\/tbody><\/table><\/div><\/figure>\n\n\n\n<p>By default, the IMAP connection uses <strong>port 143<\/strong>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Important Imapsync Options<\/h2>\n\n\n\n<p>Imapsync includes many options that allow administrators to customize the migration process.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Authentication and Security<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><div class=\"pcrstb-wrap\"><table class=\"has-fixed-layout\"><thead><tr><th>Option<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td><code>--ssl1<\/code><\/td><td>Enable SSL for source server<\/td><\/tr><tr><td><code>--ssl2<\/code><\/td><td>Enable SSL for destination server<\/td><\/tr><tr><td><code>--tls1<\/code><\/td><td>Enable TLS for source server<\/td><\/tr><tr><td><code>--tls2<\/code><\/td><td>Enable TLS for destination server<\/td><\/tr><tr><td><code>--authmech1<\/code><\/td><td>Authentication method for host1<\/td><\/tr><tr><td><code>--authmech2<\/code><\/td><td>Authentication method for host2<\/td><\/tr><\/tbody><\/table><\/div><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Folder Synchronization Options<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><div class=\"pcrstb-wrap\"><table class=\"has-fixed-layout\"><thead><tr><th>Option<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td><code>--folder<\/code><\/td><td>Sync specific folder<\/td><\/tr><tr><td><code>--folderrec<\/code><\/td><td>Sync folder recursively<\/td><\/tr><tr><td><code>--include<\/code><\/td><td>Include folders matching pattern<\/td><\/tr><tr><td><code>--exclude<\/code><\/td><td>Exclude folders matching pattern<\/td><\/tr><\/tbody><\/table><\/div><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Message Filtering Options<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><div class=\"pcrstb-wrap\"><table class=\"has-fixed-layout\"><thead><tr><th>Option<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td><code>--maxsize<\/code><\/td><td>Skip messages larger than given size<\/td><\/tr><tr><td><code>--maxage<\/code><\/td><td>Skip messages older than specified days<\/td><\/tr><tr><td><code>--minage<\/code><\/td><td>Skip messages newer than specified days<\/td><\/tr><\/tbody><\/table><\/div><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Migration Behavior Options<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><div class=\"pcrstb-wrap\"><table class=\"has-fixed-layout\"><thead><tr><th>Option<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td><code>--delete<\/code><\/td><td>Delete messages from source after transfer<\/td><\/tr><tr><td><code>--expunge<\/code><\/td><td>Permanently remove deleted messages<\/td><\/tr><tr><td><code>--syncinternaldates<\/code><\/td><td>Preserve original message timestamps<\/td><\/tr><\/tbody><\/table><\/div><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Examples of Imapsync Commands<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Test Email Migration<\/h3>\n\n\n\n<p>Before performing the actual migration, it is recommended to test the command using the <strong>&#8211;dry<\/strong> option. This simulates the migration without transferring emails.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>imapsync --noauthmd5 \\<br>--host1 source.server.com --user1 user@domain.com --password1 password1 \\<br>--host2 destination.server.com --user2 user@domain.com --password2 password2 \\<br>--dry<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Perform Email Migration<\/h3>\n\n\n\n<p>To perform the actual migration, run the same command without the <strong>&#8211;dry<\/strong> option.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>imapsync --noauthmd5 \\<br>--host1 source.server.com --user1 user@domain.com --password1 password1 \\<br>--host2 destination.server.com --user2 user@domain.com --password2 password2<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Exclude Specific Folders During Migration<\/h3>\n\n\n\n<p>You can exclude certain folders while migrating email.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>imapsync --host1 source.server.com --user1 user@domain.com --password1 password1 \\<br>--host2 destination.server.com --user2 user@domain.com --password2 password2 \\<br>--exclude 'INBOX.Spam|INBOX.Trash' --subscribe_all<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Migrate Only a Specific Folder<\/h3>\n\n\n\n<p>To migrate a particular folder, use the <strong>&#8211;folder<\/strong> option.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>imapsync --host1 source.server.com --user1 user@domain.com --password1 password1 \\<br>--host2 destination.server.com --user2 user@domain.com --password2 password2 \\<br>--folder INBOX.2024<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">POP to IMAP Email Migration<\/h2>\n\n\n\n<p>In some cases, administrators may need to migrate emails from a <strong>POP account to an IMAP server<\/strong>. This can be done using the <strong>pop2imap<\/strong> command.<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\/usr\/bin\/pop2imap \\<br>--host1 pop.domain.com --user1 user1 --passfile1 \/etc\/pass1 \\<br>--host2 imap.domain.com --user2 user2 --passfile2 \/etc\/pass2<\/pre>\n\n\n\n<p>This tool transfers messages from a POP mailbox into an IMAP account.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Manual Email Migration Method<\/h2>\n\n\n\n<p>If command-line migration tools are not available, email migration can also be performed manually using an email client.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Steps for Manual Migration<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Create two email accounts in an email client such as Outlook.<\/li>\n\n\n\n<li>Configure one account with the <strong>source mail server settings<\/strong>.<\/li>\n\n\n\n<li>Configure the second account with the <strong>destination mail server settings<\/strong>.<\/li>\n\n\n\n<li>Allow the email client to download messages from the source server.<\/li>\n\n\n\n<li>Drag and copy emails or folders from the source account to the destination account.<\/li>\n<\/ol>\n\n\n\n<p>Although this method is slower, it can be useful for <strong>small mailbox migrations<\/strong>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>Email migration is an essential task when changing mail servers or consolidating email systems. Tools like <strong>imapsync<\/strong> simplify this process by allowing administrators to transfer mailboxes between IMAP servers efficiently.<\/p>\n\n\n\n<p>With features such as incremental synchronization, message comparison, and folder preservation, imapsync ensures reliable and accurate migrations. It also supports advanced filtering and migration options that make it suitable for both small and large mailbox transfers.<\/p>\n\n\n\n<p>Whether you are migrating a single mailbox or performing a large-scale server migration, understanding how to use imapsync can significantly simplify the process.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><a href=\"https:\/\/www.supportpro.com\/requestquote.php\" title=\"\">Need Help with Email Migration?<\/a><\/h3>\n\n\n\n<p>If you need assistance with <strong>email migration, IMAP synchronization, or server administration<\/strong>, contact <strong><a href=\"https:\/\/www.supportpro.com\/requestquote.php\">SupportPRO Server Admin<\/a><\/strong> for professional support and migration services.<\/p>\n\n\n\n<div class=\"wp-block-media-text alignwide has-media-on-the-right is-stacked-on-mobile is-vertically-aligned-center has-white-background-color has-background\"><div class=\"wp-block-media-text__content\">\n<p class=\"has-large-font-size\">Partner with <strong>SupportPRO<\/strong> for 24\/7 proactive cloud support that keeps your business secure, scalable, and ahead of the curve.<\/p>\n\n\n\n<!--HubSpot Call-to-Action Code --><span class=\"hs-cta-wrapper\" id=\"hs-cta-wrapper-3350a795-db50-482f-9911-301930d1b1be\"><span class=\"hs-cta-node hs-cta-3350a795-db50-482f-9911-301930d1b1be\" id=\"hs-cta-3350a795-db50-482f-9911-301930d1b1be\"><!--[if lte IE 8]><div id=\"hs-cta-ie-element\"><\/div><![endif]--><a href=\"https:\/\/cta-redirect.hubspot.com\/cta\/redirect\/2725694\/3350a795-db50-482f-9911-301930d1b1be\" ><img decoding=\"async\" class=\"hs-cta-img\" id=\"hs-cta-img-3350a795-db50-482f-9911-301930d1b1be\" style=\"border-width:0px;\" src=\"https:\/\/no-cache.hubspot.com\/cta\/default\/2725694\/3350a795-db50-482f-9911-301930d1b1be.png\"  alt=\"Contact Us today!\"\/><\/a><\/span><script charset=\"utf-8\" src=\"https:\/\/js.hscta.net\/cta\/current.js\"><\/script><script type=\"text\/javascript\"> hbspt.cta.load(2725694, '3350a795-db50-482f-9911-301930d1b1be', {\"useNewLoader\":\"true\",\"region\":\"na1\"}); <\/script><\/span><!-- end HubSpot Call-to-Action Code -->\n<\/div><figure class=\"wp-block-media-text__media\"><img fetchpriority=\"high\" decoding=\"async\" width=\"904\" height=\"931\" src=\"https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/09\/Free-server-checkup.png\" alt=\"guy server checkup\" class=\"wp-image-12943 size-full\" srcset=\"https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/09\/Free-server-checkup.png 904w, https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/09\/Free-server-checkup-291x300.png 291w, https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/09\/Free-server-checkup-768x791.png 768w, https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/09\/Free-server-checkup-585x602.png 585w\" sizes=\"(max-width: 904px) 100vw, 904px\" \/><\/figure><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Email migration is the process of transferring mailbox data from one email account or server to another. Organizations often perform migrations when switching hosting providers, upgrading mail servers, or consolidating&hellip;<\/p>\n","protected":false},"author":5,"featured_media":12995,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_lmt_disableupdate":"","_lmt_disable":"","footnotes":""},"categories":[33],"tags":[20,106],"class_list":["post-1313","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server-migration","tag-security","tag-server"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts\/1313","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/comments?post=1313"}],"version-history":[{"count":12,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts\/1313\/revisions"}],"predecessor-version":[{"id":15963,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts\/1313\/revisions\/15963"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/media\/12995"}],"wp:attachment":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/media?parent=1313"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/categories?post=1313"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/tags?post=1313"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}