Migrate Email to EasyCloudify with IMAPSync
TL;DR — Use IMAPSync to copy your entire mail archive from any IMAP provider into your new EasyCloudify mailbox. Folders, read/unread status, flags, and message dates are all preserved. The tool is safe to re-run as many times as you like — it only copies messages that are not already at the destination.
When to Migrate
You are moving from another email provider (Gmail, Microsoft 365, Outlook.com, Fastmail, cPanel, Zoho, Proton with Bridge, your old hosting provider…) and you want your historical mail to live in your new EasyCloudify mailbox alongside new messages.
Before You Start
- An active mailbox on EasyCloudify with the destination address you want (see Email Hosting)
- IMAP access enabled at the source provider. Most providers have an IMAP toggle in account settings.
- App password at the source if it uses two-factor authentication (Gmail, Outlook, Fastmail, etc.). Use the app password, not your account password.
- A computer with Linux, macOS, or Windows (WSL works on Windows) and roughly the same amount of free disk as your old mailbox
💡 Source-side accounts that need extra steps:
- Gmail — enable IMAP in Settings → Forwarding and POP/IMAP, and generate an app password under your Google Account → Security → App passwords.
- Microsoft 365 / Outlook.com — enable IMAP in Outlook on the web → Settings → Mail → POP and IMAP. Generate an app password if 2FA is on.
Step 1 — Install IMAPSync
macOS
brew install imapsync
Linux (Debian / Ubuntu)
sudo apt-get update sudo apt-get install imapsync
Linux (Fedora / RHEL)
sudo dnf install imapsync
Windows
Use the pre-built Windows binary or run IMAPSync from a Linux distribution under WSL.
Verify the install:
imapsync --version
Step 2 — Gather Connection Details
You need four pieces of information for each side.
Source (the provider you are leaving)
| Field | Example |
|---|---|
| Host | imap.gmail.com |
| Port | 993 (SSL/TLS) |
| Username | [email protected] |
| Password | App password or account password |
Common source hosts:
| Provider | IMAP host |
|---|---|
| Gmail / Google Workspace | imap.gmail.com |
| Microsoft 365 | outlook.office365.com |
| Outlook.com | outlook.office365.com |
| Yahoo | imap.mail.yahoo.com |
| Fastmail | imap.fastmail.com |
| iCloud Mail | imap.mail.me.com |
| Most cPanel hosts | mail.yourolddomain.com |
Destination (your new EasyCloudify mailbox)
| Field | Value |
|---|---|
| Host | Auto-detected (use the value shown in /cloudpanel/mailboxes for your mailbox) |
| Port | 993 (SSL/TLS) |
| Username | Your full email address (e.g. [email protected]) |
| Password | Your EasyCloudify mailbox password |
Step 3 — Test the Connection
Always run IMAPSync once with --dry first. This connects to both sides, lists folders, and reports what would be copied — without moving a single message.
imapsync \ --host1 imap.gmail.com \ --user1 [email protected] \ --password1 'YOUR_SOURCE_APP_PASSWORD' \ --ssl1 \ --host2 imap.easycloudify.example \ --user2 [email protected] \ --password2 'YOUR_EASYCLOUDIFY_PASSWORD' \ --ssl2 \ --dry
Replace imap.easycloudify.example with the destination IMAP hostname shown for your mailbox in /cloudpanel/mailboxes.
You should see a summary like:
Folders source/destination found: 12
Messages source/destination: 4231 / 0
Would copy 4231 messages, total size XX MB.
If you see authentication errors, double-check the passwords (app passwords on the source, mailbox password on the destination).
Step 4 — Run the Real Migration
Once the dry run is clean, remove --dry to run the actual sync.
imapsync \ --host1 imap.gmail.com \ --user1 [email protected] \ --password1 'YOUR_SOURCE_APP_PASSWORD' \ --ssl1 \ --host2 imap.easycloudify.example \ --user2 [email protected] \ --password2 'YOUR_EASYCLOUDIFY_PASSWORD' \ --ssl2 \ --automap
IMAPSync prints progress message-by-message. Large mailboxes (several GB) can take hours — leave the terminal open or run it inside screen / tmux.
When it finishes, you'll see a summary of messages copied, skipped (already present), and any errors.
Useful Flags
| Flag | Purpose |
|---|---|
--automap | Match standard folders (Sent, Drafts, Trash, Spam) across providers automatically |
--regextrans2 's/\[Gmail\]\///g' | Strip Gmail's [Gmail]/ folder prefix |
--exclude 'All Mail' | Skip Gmail's "All Mail" view (avoids duplicating every message) |
--noresyncflags | Don't keep re-syncing read/unread flags on subsequent runs |
--delete2duplicates | Remove duplicate messages on the destination |
--skipsize | Faster for very large mailboxes when source/destination report sizes differently |
Gmail-Specific Recommended Command
imapsync \ --host1 imap.gmail.com --user1 [email protected] --password1 'APP_PASSWORD' --ssl1 \ --host2 imap.easycloudify.example --user2 [email protected] --password2 'PWD' --ssl2 \ --automap \ --exclude '\[Gmail\]/All Mail' \ --exclude '\[Gmail\]/Important' \ --regextrans2 's/\[Gmail\]\///g' \ --regextrans2 's/\[Gmail\].(.*)/$1/'
This skips Gmail's virtual "All Mail" and "Important" labels (which would otherwise duplicate every message) and strips the [Gmail]/ prefix from folder names.
Step 5 — Cut Over Your DNS / MX Records
When the IMAPSync run is complete, switch the MX records for your domain so new mail starts arriving at EasyCloudify. Until that switch, new messages will continue landing at the old provider — re-run IMAPSync after the cut-over to pick up the last few messages.
DNS for EasyCloudify-hosted domains is managed automatically — you don't need to change MX records yourself unless your domain is not on EasyCloudify DNS. See DNS Management.
Step 6 — Final Re-Sync
After MX is switched and a few hours have passed (give old senders time to retry), run IMAPSync one final time with the same command. It will pick up only the messages that arrived after the previous run.
You're now fully migrated. You can close the old mailbox at the source provider.
Troubleshooting
"AUTHENTICATIONFAILED" on the source
Use an app password instead of your main password. Two-factor authentication on Gmail, Microsoft 365, Yahoo, and Fastmail requires an app-specific password for IMAP.
"AUTHENTICATIONFAILED" on the destination
Use your EasyCloudify mailbox password (set in /cloudpanel/mailboxes), not your dashboard login password.
IMAPSync is too slow / connection drops
Add --useuid --usecache to skip already-copied messages quickly. Run inside tmux or screen so a network blip doesn't kill the migration.
Folder hierarchy looks wrong on the destination
Re-run with --automap and the relevant --regextrans2 rules above. IMAPSync is idempotent — re-running is safe and only copies missing messages.
Some messages didn't transfer
Check the IMAPSync output for individual errors. The most common cause is messages over the destination provider's per-message size limit (rare for normal email; common for messages with very large attachments). Forward or download those manually.
Migration FAQ
Will my read/unread status be preserved?
Yes. IMAPSync preserves \Seen, \Flagged, \Answered, \Draft, and \Deleted flags.
Will message dates be preserved?
Yes. IMAPSync uses each message's INTERNALDATE so they sort in the correct chronological order.
Will Gmail labels survive?
Gmail labels are translated into IMAP folders. A message with two labels appears in two folders. Use --exclude '\[Gmail\]/All Mail' to avoid duplicating everything.
Can I migrate calendars and contacts too?
IMAPSync only handles mail. Export calendars (ICS) and contacts (vCard) from the old provider and import them into the new mailbox via webmail (Settings → Calendar / Address Book → Import).
How long should I keep the old mailbox open?
Keep it open for at least one full DNS TTL cycle (typically 24–48h) after switching MX, so any in-flight messages can be picked up by a final IMAPSync run.