{"id":1563,"date":"2017-03-23T21:14:49","date_gmt":"2017-03-23T21:14:49","guid":{"rendered":"http:\/\/www.incredigeek.com\/home\/?p=1563"},"modified":"2017-03-23T22:01:19","modified_gmt":"2017-03-23T22:01:19","slug":"moving-emails-to-new-host-with-imapsync","status":"publish","type":"post","link":"https:\/\/www.incredigeek.com\/home\/moving-emails-to-new-host-with-imapsync\/","title":{"rendered":"Moving emails to new host with imapsync"},"content":{"rendered":"<p>More info about imapsync <a href=\"http:\/\/imapsync.lamiral.info\/\" target=\"_blank\">here<\/a><\/p>\n<p><strong>Install imapsync<\/strong><\/p>\n<p>CentOS 7, Works on cPanel servers too<\/p>\n<pre>yum install epel-release &amp;&amp; yum install imapsync<\/pre>\n<p>Once installed check and make sure it works.<\/p>\n<pre>imapsync --version<\/pre>\n<p>If it gives you the version number you should be good to go.<\/p>\n<p><strong>Move email account<\/strong><\/p>\n<pre>imapsync --host1 mail.emaildomain.com --user1 username@emaildomain.com --password1  \"password1\" --host2 mail.exampledomain.com --user2 username@movetodomain.com --password2  \"password2\"<\/pre>\n<p>Example :<\/p>\n<pre>imapsync --host1 mail.myemail.com --user1 bob@myemail.com --password1  \"password1\" --host2 mail.incredigeek.com --user2 bob@incredigeek.com --password2  \"password2\"<\/pre>\n<p><strong>Moving Multiple accounts<\/strong><\/p>\n<p>Best way to move multiple accounts is to use a script and and a list that contains all the usernames and passwords to the accounts you want to move.<\/p>\n<p>example scripts can be found on the imapsync website here is a <a href=\"http:\/\/imapsync.lamiral.info\/examples\/sync_loop_unix.sh\" target=\"_blank\">script<\/a> example and here is the example <a href=\"http:\/\/imapsync.lamiral.info\/examples\/file.txt\" target=\"_blank\">file.txt<\/a><\/p>\n<p>Example script.<\/p>\n<pre>#!\/bin\/sh\r\n#\r\n# $Id: sync_loop_unix.sh,v 1.6 2015\/11\/04 18:23:04 gilles Exp gilles $\r\n\r\n# Example for imapsync massive migration on Unix systems.\r\n# See also http:\/\/imapsync.lamiral.info\/FAQ.d\/FAQ.Massive.txt\r\n#\r\n# Data is supposed to be in file.txt in the following format:\r\n# host001_1;user001_1;password001_1;host001_2;user001_2;password001_2;\r\n# ...\r\n# Separator is character semi-colon \";\" it can be changed by any character changing IFS=';' \r\n# in the while loop below.\r\n# # Each line contains 6 columns, columns are parameter values for \r\n# --host1 --user1 --password1 --host2 --user2 --password2\r\n# and a trailing empty fake column to avaid CR LF part going \r\n# in the 6th parameter password2. Don't forget the last semicolon.\r\n#\r\n# You can add extra options after the variable \"$@\" \r\n# Use character backslash \\ at the end of each suplementary line, except for the last one.\r\n# You can also pass extra options via the parameters of this script since\r\n# they will be in \"$@\"\r\n\r\n# The credentials filename \"file.txt\" used for the loop can be renamed \r\n# by changing \"file.txt\" below.\r\n\r\n\r\necho Looping on account credentials found in file.txt\r\necho\r\n\r\n{ while IFS=';' read  h1 u1 p1 h2 u2 p2 fake\r\n    do \r\n        { echo \"$h1\" | egrep \"^#\" ; } &gt; \/dev\/null &amp;&amp; continue # this skip commented lines in file.txt\r\n        echo \"==== Starting imapsync from host1 $h1 user1 $u1 to host2 $h2 user2 $u2 ====\"\r\n        imapsync --host1 \"$h1\" --user1 \"$u1\" --password1 \"$p1\" \\\r\n                 --host2 \"$h2\" --user2 \"$u2\" --password2 \"$p2\" \\\r\n                 \"$@\"  \r\n        echo \"==== Ended imapsync from host1 $h1 user1 $u1 to host2 $h2 user2 $u2 ====\"\r\n        echo\r\n    done \r\n} &lt; file.txt<\/pre>\n<p>Example list of accounts to<\/p>\n<pre>mail.maildomain.com;user1@incredigeek.com;password1;mail.incredigeek.com;user2@incredigeek.com;password2;<\/pre>\n<p>&nbsp;<\/p>\n<h1>How to use,<\/h1>\n<p>You can run these command from a Linux computer<\/p>\n<h2>Download script<\/h2>\n<pre>wget www.incredigeek.com\/home\/downloads\/imapsync\/imapsync_loop.sh<\/pre>\n<h2>Make the script executable<\/h2>\n<pre>chmod +x imapsync_loop.sh<\/pre>\n<h2>Create a text file named &#8220;imapsync_list.txt&#8221;<\/h2>\n<p>This file will contain the mail server to transfer from, username, and password, and then the mail server to transfer to, username and password.\u00a0 Add one line per account.<\/p>\n<p>Example:<\/p>\n<pre>mail.servertotransferfrom.com;Username1;Password1;mail.servertomoveto.com;Username2;Password2;\r\nmail.servertotransferfrom.com;testuser;123456;mail.servertomoveto.com;bob;123456;<\/pre>\n<h2>Execute the script to start moving mail<\/h2>\n<pre>.\/imapsync_loop.sh<\/pre>\n<h2>Troubleshooting<\/h2>\n<p>In the username you may need to use the username@domainname.tld, so if the username is bob, and the mail domain is incredigeek.com, use bob@incredigeek.com for the username in the imapsync_list.txt.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>More info about imapsync here Install imapsync CentOS 7, Works on cPanel servers too yum install epel-release &amp;&amp; yum install imapsync Once installed check and make sure it works. imapsync &#8211;version If it gives you the version number you should &hellip; <a href=\"https:\/\/www.incredigeek.com\/home\/moving-emails-to-new-host-with-imapsync\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23,4,195,3],"tags":[17,8,196,223,337,338,7],"class_list":["post-1563","post","type-post","status-publish","format-standard","hentry","category-centos-linux","category-command-line","category-cpanel","category-linux","tag-centos","tag-command-line-2","tag-cpanel-2","tag-email","tag-imap","tag-imapsync","tag-linux-2"],"_links":{"self":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/1563","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/comments?post=1563"}],"version-history":[{"count":10,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/1563\/revisions"}],"predecessor-version":[{"id":3128,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/1563\/revisions\/3128"}],"wp:attachment":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/media?parent=1563"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/categories?post=1563"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/tags?post=1563"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}