IMAP copy
I have a client that recently wanted to move onto their own hosting account. Web files were no problem, tar and gzip’d their directory’s contents in one shell window, wget’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 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’t authenticate src and dest in a single connection, or didn’t read recursively into the folder structure. Finally found IMAPcopy, a project that hasn’t had an update in six years and was still alive on the interwebs. And guess what? It worked.
Download linux binary here and source here. In case the original project page ever goes down, I have it saved here for posterity’s sake.
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’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 “-e” flag, which included empty folders in its operation. Sweet!
Client keeps highly organized IMAP folders and I learned something new.
UPDATE 2018-05-08:
To simplify this whole process I now use imapsync
from the command line. So just apt-get install imapsync
or dnf install imapsync
depending on your distro.
UPDATE 2020-01-24:
To simplify this whole process even further I recommend mbsync
. I switched hosts so this made transferring multiple mailbox accounts less painful since it allows config via a file.