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):
email | name | password | quota | domain_plan |
user@domain.com | John Doe | $6$gXTAxV55yCGJ09C/$9cMquoWx43H0fChCpEoM4dZ4md.c4qlxGkmd91EJK9Kn.V/gSknM7IzDRKcslYBLHknB4.HG/w1Qn/XUyFQJC/ | 1024 | default |
- 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
- run
docker compose exec dovecot-mailcow doveadm quota recalc -A
mailcow/mailcow-dockerized516