Email migration requires careful planning to avoid downtime and lost messages. This guide covers moving your mail services between Breeze instances with minimal disruption.
Pre-Migration Checklist
- Document current mail server software (Postfix, Dovecot, etc.) and versions
- Export all mailbox accounts and aliases
- Record DNS records: MX, SPF, DKIM, and DMARC
- Lower your MX record TTL to 300 seconds several days before migration
Step 1: Set Up the New Mail Server
sudo apt install -y postfix dovecot-imapd dovecot-pop3d
sudo systemctl enable postfix dovecot
Replicate your configuration files from the old server, adjusting hostnames and paths as needed.
Step 2: Sync Mailboxes
Use imapsync to transfer all messages between servers:
imapsync --host1 old.example.com --user1 user@example.com --password1 "oldpass" \
--host2 new.example.com --user2 user@example.com --password2 "newpass" \
--ssl1 --ssl2
Step 3: Update DNS Records
Point MX records to the new server IP:
example.com. 300 IN MX 10 mail.example.com.
mail.example.com. 300 IN A 203.0.113.50
Update SPF and DKIM records to reference the new server.
Step 4: Verify Delivery
echo "Test email" | mail -s "Migration test" user@example.com
sudo tail -f /var/log/mail.log
Post-Migration
- Run imapsync a second time to catch messages that arrived during DNS propagation
- Monitor both servers for 48 hours before decommissioning the old one
- Restore MX TTL to its normal value once migration is confirmed