An email migration has two separate parts: moving old messages (copying from server to server) and redirecting new mail (changing the MX record). The classic mistake is switching MX first and worrying about old mail later, and staff open empty mailboxes the next morning. The right order is prepare, copy, switch, then sync one last time.
Before you start
- A list of every mailbox on the old host with its password, or the ability to reset them temporarily.
- The old server’s IMAP settings: hostname and port
993. - The new service ready, plus a hostname that reaches it directly before DNS changes, such as the server’s hostname.
mail.example.comstill points to the old server until you switch the records. - Access to the domain’s DNS.
- A list of what isn’t mail: forwarders, autoresponders, filters, and addresses used by website forms.
Your options
| Method | Fits | Note |
|---|---|---|
| Full cPanel account transfer | cPanel to cPanel | Moves mailboxes, messages and settings together; see move a site from one cPanel to another |
| imapsync | Any two IMAP providers | Good for many mailboxes; can be re-run without duplicating mail |
| A mail client such as Thunderbird | One or two mailboxes | Add both accounts and copy folders from old to new |
| Uploading POP3 mail | Mail exists only on one computer | Add the new mailbox as IMAP in the same client and copy the folders into it |
Steps
1. Lower the TTL a day or two ahead
In your current DNS, set the TTL of the MX record, mail and any record you’ll change to 300 seconds. The new value only takes effect once the old cached value expires, so do this early. Read up on TTL if the concept is new.
2. Create the same mailboxes on the new service
In cPanel → Email → Email Accounts → + Create, create every address with exactly the same name and enough quota for the old mailbox’s size. Recreate forwarders, autoresponders and filters now too.
3. Copy the old messages
With imapsync, from any machine that has it installed:
imapsync \
--host1 mail.old-host.net --user1 [email protected] --password1 'OLD_PASS' --ssl1 \
--host2 server.new-host.net --user2 [email protected] --password2 'NEW_PASS' --ssl2 \
--automap
--automapmatches folders with different names, such asSent ItemsandSent.- Run it first with
--dryto see what would be copied without copying anything. - For several mailboxes, put the details in a file as
email;old_pass;new_passand loop:
while IFS=';' read -r user p1 p2; do
imapsync --host1 mail.old-host.net --user1 "$user" --password1 "$p1" --ssl1 \
--host2 server.new-host.net --user2 "$user" --password2 "$p2" --ssl2 --automap
done < mailboxes.csv
Delete the password file when you’re done. In Thunderbird, add both accounts, select the messages in each old folder, right-click, choose Copy To and pick the matching folder in the new account.
4. Switch MX at a quiet time
Pick the end of a working day or a weekend, then do one of two things:
- Change the nameservers to the new provider, and the mail records come with them: see change your nameservers.
- Edit only the records in your current DNS: MX, the A record for
mail, SPF (remove the old server’s IP, add the new one) and the new DKIM key from the new provider.
Delete all the old MX records rather than leaving them as a lower-priority backup, or some senders will keep delivering to the old server. Authentication details are in set up SPF, DKIM and DMARC.
5. Watch both servers during propagation
Check the MX record with the MX lookup tool until it shows the new value. While DNS propagates, some messages may still arrive at the old server, so don’t cancel the old account yet; keep an eye on it through the old webmail using the server’s hostname.
6. Run a final sync
After 24 - 48 hours, run the same imapsync command again. It skips messages it already copied and only moves what reached the old server after the first run.
7. Update devices and the website
- If devices use
mail.example.com, re-entering the new password is often all it takes. If problems persist, remove the account and add it again as IMAP. - POP3 users have their mail only on their device; back it up before changing anything.
- Update the website’s SMTP settings, such as a WordPress SMTP plugin, with the new server and password.
8. Cancel the old service once you’re sure
When several days pass with no new mail on the old server, and messages sent from the new one show PASS for SPF and DKIM, cancel the old service: keeping a final copy of the mailboxes if you can.
Troubleshooting
- Duplicate messages: mail was copied twice with two different tools, or by hand and then with imapsync. Use the same tool for the first copy and the final sync.
- Missing folders or odd names like
INBOX.INBOX.Sent: the two servers structure folders differently. Use--automapand review the result with--drybefore copying. AUTHENTICATIONFAILED: the username isn’t the full address, the password is wrong, or you’re temporarily blocked after repeated failures.- Copy stops on a large mailbox: run the same command again; it carries on where it stopped without duplicating.
- Mail still arrives at the old server days later: an old MX record survived, or you edited DNS somewhere your nameservers don’t point.
- Nothing arrives at the new server: under Email → Email Routing, make sure Local Mail Exchanger is selected, and see not receiving emails.
On ArabyHost
If you’re moving to ArabyHost, our team offers free migration help for email and websites, including copying mailboxes and their messages. Point the domain to ns1.arabicode.com and ns2.arabicode.com and SPF and DKIM for the new service are created automatically, and daily JetBackup backups include the new mailboxes. If you only need email, without the website, choose a business email plan. Remember that sending is capped per hour per domain, so don’t make the day after the move your newsletter day.
FAQ
Will I lose emails during the migration?
Not if you follow the right order. While DNS propagates some messages may still reach the old server, so keep the old account active for a few days and run a final sync that moves them into the new mailboxes.
Do I need every mailbox password?
Yes. Copying over IMAP needs each mailbox's password on both servers. If you don't know them, reset them temporarily in the old hosting panel and hand out the new passwords after the move.
How long does mail take to switch after changing MX?
It depends on the TTL. If you lowered it to 300 seconds a day or more beforehand, most mail switches within minutes to an hour. With a long TTL left in place it can take up to 48 hours.