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?
There are couple of options you could try:
- Check out Google Apps IMAP migration guide, you can setup an Google Apps IMAP account as a temporary placeholder account while you do the transfer.
- Use a third party service like YippieMove. Note that this costs $15 per account
- Do it yourself! A blog post on how you can transfer mails using PHP
IMAPSync is the tool your looking for. IMAPSync
In the FAQ there are plenty of good examples
-
-
-
-
Totally recommended! Just did some migrations from Windows command line. One thing for the impatient: after the program displays number of messages in both accounts, it seems that it has hung up. But it does something in the background and one has to wait a longer while before it starts displaying info about copied messages. – boryn Nov 23 '20 at 11:08
-
The basic parameters to run the sync:
./imapsync --addheader --automap --host1 SERVER1 --host2 SERVER2 --password1 'PASS1' --password2 'PASS2' --user1 user@domain1.com --user2 user@domain2.com
– boryn Nov 23 '20 at 11:10
Use the reliable Mutt (http://www.mutt.org/).
mutt -f imap://username@sourceimaphost/INBOX/folder
- Tag selected messages by
t
, or tag all messages byT
and 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.
-
1You can also use
imaps:
instead ofimap:
. If theusername
part already contains a@
(e.g. as in Google Apps), replace it with%40
. Example:imaps://username%40domain.com@imap.gmail.com/INBOX/folder
. – musiphil Aug 19 '15 at 20:41 -
OfflineIMAP is another option (http://offlineimap.org/).
-
I didn't know it could do synchronisation too, but it does, and seems stable. Good idea! – qris Mar 6 '14 at 10:24
-
-
@JDuarteDJ: Did you downvote for the reasons you mention!? Given the question puts no restrictions on such things, that would be highly inappropriate. – equaeghe Jan 25 '16 at 21:08
-
@equaeghe I'm sorry that you find it inappropriate. I find that from the question one can understand that the solution should be as simple and direct as possible. I will give you the fact that no OS is mentioned so if one should consider a linux OS these limitations don't apply, I can't take it back but given this I would if I could. – JDuarteDJ Jan 26 '16 at 11:39
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:
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