{"id":259,"date":"2012-06-14T14:13:56","date_gmt":"2012-06-14T19:13:56","guid":{"rendered":"http:\/\/www.marcblase.com\/blog\/?p=259"},"modified":"2020-01-24T09:15:03","modified_gmt":"2020-01-24T15:15:03","slug":"imap-copy","status":"publish","type":"post","link":"https:\/\/ma.rcbla.se\/blog\/2012\/06\/imap-copy\/","title":{"rendered":"IMAP copy"},"content":{"rendered":"<p>I have a client that recently wanted to move onto their own hosting account. Web files were no problem, tar and gzip&#8217;d their directory&#8217;s contents in one shell window, wget&#8217;d in another, decompressed files. Done. Dump database from one phpmyadmin window, then import into another. Done. This was the easy part.<\/p>\n<p>Hard part was they also wanted to move their entire email configuration. These clients are very organized, which means that there are lots of nested IMAP folders. Tried a few tools out but they either timed out, couldn&#8217;t authenticate src and dest in a single connection, or didn&#8217;t read recursively into the folder structure. Finally found <a href=\"http:\/\/home.arcor.de\/armin.diehl\/imapcopy\/imapcopy.html\">IMAPcopy<\/a>, a project that hasn&#8217;t had an update in six years and was still alive on the interwebs. And guess what? It worked.<\/p>\n<p>Download linux binary <a href=\"http:\/\/www.marcblase.com\/blog\/wp-content\/uploads\/2012\/09\/imapcopy.tar.gz\">here<\/a> and source <a href=\"http:\/\/www.marcblase.com\/blog\/wp-content\/uploads\/2012\/06\/IMAPCopySrc.zip\">here<\/a>. In case the original project page ever goes down, I have it saved <a href=\"http:\/\/www.marcblase.com\/blog\/wp-content\/uploads\/2012\/09\/IMAPcopy.html\">here<\/a> for posterity&#8217;s sake.<\/p>\n<p>Since my clients are so organized they nested folders without any messages in either the parent, grandparent or great-grandparent folders. Great for organization, not so much in looking for messages, so the program skipped the first one that didn&#8217;t contain a message even if the rest of that branch contained messages. So, I simply needed to run the program, once configured with a &#8220;-e&#8221; flag, which included empty folders in its operation. Sweet!<\/p>\n<p>Client keeps highly organized IMAP folders and I learned something new.<\/p>\n<p><small>UPDATE 2018-05-08:<\/small><\/p>\n<p>To simplify this whole process I now use <code>imapsync<\/code> from the command line. So just <code>apt-get install imapsync<\/code> or <code>dnf install imapsync<\/code> depending on your distro.<\/p>\n<p><small>UPDATE 2020-01-24:<\/small><\/p>\n<p>To simplify this whole process even further I recommend <a href=\"http:\/\/isync.sourceforge.net\/mbsync.html\"><code>mbsync<\/code><\/a>. I switched hosts so this made transferring multiple mailbox accounts less painful since it allows config via a file.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have a client that recently wanted to move onto their own hosting account. Web files were no problem, tar and gzip&#8217;d their directory&#8217;s contents in one shell window, wget&#8217;d in another, decompressed files. Done. Dump database from one phpmyadmin window, then import into another. Done. This was the easy part. Hard part was they [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[51,11,3,39],"tags":[],"class_list":["post-259","post","type-post","status-publish","format-standard","hentry","category-cli","category-coding","category-discoveries","category-email"],"_links":{"self":[{"href":"https:\/\/ma.rcbla.se\/blog\/wp-json\/wp\/v2\/posts\/259","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ma.rcbla.se\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ma.rcbla.se\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ma.rcbla.se\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ma.rcbla.se\/blog\/wp-json\/wp\/v2\/comments?post=259"}],"version-history":[{"count":11,"href":"https:\/\/ma.rcbla.se\/blog\/wp-json\/wp\/v2\/posts\/259\/revisions"}],"predecessor-version":[{"id":666,"href":"https:\/\/ma.rcbla.se\/blog\/wp-json\/wp\/v2\/posts\/259\/revisions\/666"}],"wp:attachment":[{"href":"https:\/\/ma.rcbla.se\/blog\/wp-json\/wp\/v2\/media?parent=259"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ma.rcbla.se\/blog\/wp-json\/wp\/v2\/categories?post=259"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ma.rcbla.se\/blog\/wp-json\/wp\/v2\/tags?post=259"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}