These are the steps I followed to migrate my emails from cPanel to mailcow:
- Create & run a shell script to get all email accounts and their hashed passwords on the cPanel server
- Copy the values over to a spreadsheet and format it as follows (without the headers):
- Export it as comma separated csv and use mailcowtools to import it via the API. Note that I have updated it to autocreate the domains and support domain plans (manually because mc API doesn’t provide a templates endpoint).
- Use imap sync if you know the passwords or rsync/scp to copy the email data over from cpanel to mailcow. I used scp.
If you use scp/rsync like I did you need 2 more steps:
- Run the encrypt commands from the documentation
docker compose exec dovecot-mailcow doveadm quota recalc -A