How to migrate emails from another host or Gmail to EgWeb (IMAP migration)
Moving to EgWeb hosting does not mean losing your old messages. This guide explains how to migrate emails from another host or from Gmail to your EgWeb mailbox using IMAP, either with a free email program (good for a few mailboxes) or with the imapsync tool (good for many mailboxes), and how to switch over without losing new mail.
Before you start
- You need the old mailbox details: server name, email and password, with IMAP access working.
- For Gmail and Google accounts, IMAP usually needs an App Password, which requires 2-Step Verification on the Google account. A Google Workspace admin may also need to allow it.
- Make sure your EgWeb hosting plan has enough disk space for all the mail you are moving.
Step 1: Create the mailboxes on EgWeb
In cPanel, create every address with the same name it had before. See How to create an email account. Give each mailbox a large enough quota.
Step 2: Copy the old mail (before changing DNS)
While your domain still delivers mail to the old host, copy the existing messages. Choose one of the two methods below.
Method A: Use Thunderbird (a few mailboxes)
- Install Thunderbird and add the old mailbox with IMAP, using the old server name.
- Add the new EgWeb mailbox. Because your domain still points to the old host, use the EgWeb server hostname shown in cPanel Connect Devices instead of
mail.yourcompany.com. See How to set up your company email in Thunderbird. - Wait until all old folders finish downloading.
- Select messages in each old folder, right-click and choose Copy To the matching folder in the new account. Copy folder by folder.
Method B: imapsync (many mailboxes, server to server)
imapsync copies a mailbox directly from one IMAP server to another. It is safe to run several times: messages already copied are skipped. It is run from a Linux server or VPS, not from shared hosting. If you are on shared hosting, ask EgWeb support and we can help with a migration.
imapsync \
--host1 imap.oldhost.com --user1 info@yourcompany.com --passfile1 /root/old.pass --ssl1 \
--host2 mail.yourcompany.com --user2 info@yourcompany.com --passfile2 /root/new.pass --ssl2 \
--automap
For Gmail, exclude Gmail's virtual folders so messages are not copied twice:
imapsync \
--host1 imap.gmail.com --user1 you@gmail.com --passfile1 /root/gmail.pass --ssl1 \
--host2 mail.yourcompany.com --user2 info@yourcompany.com --passfile2 /root/new.pass --ssl2 \
--automap --exclude "All Mail|Important|Starred"
chmod 600 /root/old.pass) and use --passfile1/--passfile2, so passwords do not appear in your shell history. Delete the files when you finish. Add --dry first to see what would be copied without copying anything.Step 3: Point the domain's email to EgWeb
Change your nameservers or MX records to EgWeb (How to point your domain to your hosting and How to manage DNS records). DNS changes can take a few hours to reach everyone, so some mail may still arrive at the old host during that time.
Step 4: Run a final sync
After a day or two, copy again from the old mailbox (run imapsync again, or copy new messages in Thunderbird). This picks up any mail that reached the old host during DNS propagation. Then keep the old account active for a short time before you cancel it.
Step 5: Update your devices
Remove the old account from phones and computers and add the EgWeb mailbox, for example in Outlook or iPhone and Android.
Common problems
- Login to old server fails: check whether IMAP is enabled there, or whether an App Password is required.
- Quota exceeded on EgWeb: increase the mailbox quota in cPanel → Email Accounts → Manage, or upgrade the plan.
- Duplicate messages from Gmail: exclude
All Mail,ImportantandStarredas shown above.
Frequently asked questions
Will migration delete mail from the old server?
No. Both methods copy messages. The old mailbox is not changed unless you delete things yourself.
Can I migrate POP3-only accounts?
If the old host offers only POP3, old mail may exist only on the computer that downloaded it. In that case, upload it from that computer's mail program to the new IMAP mailbox.
Do contacts and calendars move too?
No. IMAP copies email only. Export contacts as vCard or CSV and import them separately.