Migrating from cPanel email to Mailcow involves transferring mailboxes, historical emails and DNS settings. Done correctly, downtime can be under 30 minutes.
Migration Plan
- Set up Mailcow on new server
- Create all mailboxes in Mailcow
- Sync emails via IMAP using imapsync
- Lower MX TTL to 300
- Update MX records to new server
- Run final imapsync to catch new emails
Step 1 — Install imapsync
sudo apt install imapsync -y
Step 2 — Create Mailboxes in Mailcow
Mailcow Admin → Mailboxes → create each mailbox that exists in cPanel
Step 3 — Sync Emails
# Sync single mailbox
imapsync --host1 old.cpanelserver.com --user1 [email protected] --password1 "oldpassword" --host2 mail.yourdomain.com --user2 [email protected] --password2 "newpassword" --ssl1 --ssl2 --syncinternaldates
Step 4 — Bulk Migration Script
#!/bin/bash
# Add your mailboxes here
MAILBOXES=(
"[email protected]:oldpass:newpass"
"[email protected]:oldpass:newpass"
)
for MB in "${MAILBOXES[@]}"; do
USER=$(echo $MB | cut -d: -f1)
PASS1=$(echo $MB | cut -d: -f2)
PASS2=$(echo $MB | cut -d: -f3)
imapsync --host1 old.cpanelserver.com --user1 $USER --password1 $PASS1 --ssl1 --host2 mail.yourdomain.com --user2 $USER --password2 $PASS2 --ssl2 --syncinternaldates --nofoldersizes
done
Step 5 — Switch MX Records
# Lower TTL 24 hours before
yourdomain.com MX 10 mail.yourdomain.com # new server
# Run imapsync one more time after DNS switch
# to catch emails received during transition
Conclusion
Email migrations require careful planning to avoid data loss. Our team handles complete email server migrations with zero message loss guaranteed.
Comments