I have to move many, many emails (over a thousand) from an old IMAP hosting provider to a new IMAP hosting provider. I know I can just set up the old and new accounts in Thunderbird and drag and drop, but it's very slow and keeps timing out. Is there a better, more automated way to copy all messages (and all mailboxes) between IMAP servers?
5 Answers
Use the reliable Mutt (http://www.mutt.org/).
mutt -f imap://username@sourceimaphost/INBOX/folder- Tag selected messages by
t, or tag all messages byTand entering~A. (WithT, you can specify various patterns (http://www.mutt.org/doc/manual/manual-4.html#ss4.2). - Move tagged messages by
;s("save") and enterimap://username@destimaphost/INBOX/folder. (This marks the source messages as deleted(D); if you don't want that, use;C("copy") instead.) - You can repeat 2 and 3 as needed.
- Quit by
q. You may choose to purge the deleted messages.
This allows to move a folder from one account to another. Repeat this for multiple folders.
- 361
You can also use isync/mbsync. Just used it (over a few days, due to quota limits imposed by Google and (specially) Apple) to copy a few dozen thousand emails from Gmail do iCloud. After the copy, deleting the emails on the GMail side was easier and faster (to delete everything) via the web interface.
For continuous retry (after disconnection due to quota limits) until successfully copying everything, one could run it like (bash):
$ while date +"%F %T Restarting..." && ! mbsync channel_name; do sleep 3600; done
- 258
Originally we wrote this article on email migration issues: http://alloraconsulting.com/it-solutions/28-transferring-email-from-one-host-to-another
The article is pretty old, but after many years of occasional bulk migrations from IMAP into Exchange / IMAP it's OpenSource solutions that worked the best, like this one:
- 1