Migrating email between hosted providers
Recently I ran into a small problem. A customer of mine was moving her site to a new hosting provider. Her old provider was Windows-based and her new provider was Linux-based. The old provider did not use cPanel. The old mail system was SmarterMail Enterprise 4.3 and the new Linux-based mail system was Courier.
The customer had a few mailboxes at the old location that were accessed via a webmail interface, so there were lots of emails stored in the Inbox and Sent folders in all of the accounts. To complicate matters, I only had POP3 access to old email server. Luckily, with the new provider I had SSH access, so this gave me some options.
I knew that with fetchmail I could transfer the contents of the old Inbox to the new one. But what about the Sent folder? Those email had to be moved as well, but with POP3 fetchmail does not support alternate folders. As it turned out, there was a low-tech solution to this annoying problem: creating a temporary folder in both email accounts. Here are the steps:
- In your OLD webmail create a folder called “temp”
- in your NEW webmail create a folder called “temp”
- Login to your NEW server via SSH and type the following fetchmail command:
fetchmail --keep --all --protocol POP3 --username --smtphost localhost --smtpname --batchlimit 10 --invisible --norewrite
fetchmail --keep --all --protocol POP3 --username email@example.com --smtphost localhost --smtpname firstname.lastname@example.org --batchlimit 10 --invisible --norewrite pop3.oldprovider.com
You will be prompted for your old email password and then fetchmail will start the transfer, which may take some time. This will transfer (without deleting) your old Inbox contents to your Inbox at the new provider.
- In your NEW webmail move everything from Inbox to the “temp” folder you created.
- In your OLD webmail move everything from Inbox to the “temp” folder.
- In your OLD webmail move everything from Sent to Inbox
- Repeat step 3. This will put the contents of your OLD Sent folder into your NEW Inbox.
- In NEW webmail move contents of Inbox to Sent.
- In NEW webmail move contents of “temp” to Inbox.
- In OLD webmail move contents of Inbox to Sent
- In OLD webmail move contents of “temp” to Inbox
It is a tedious process but it works. If there is no other alternative and the emails have to be moved, then make yourself some coffee and get ready to do some heavy email moving.