Possibly the most tortuous endeavour available to any tech project, migrating mail accounts without some kind of automation (cPanel-to-cPanel, for example) is one of those necessary evils that comes around once in a while and requires a suitable strategy to help you avoid any loss of service and/or emails for you and your clients.
This is specific to generic IMAP accounts, not Exchange/ActiveSync or POP (why is anyone still using POP?).
- Create email account/s on new server
- Create A record (DNS) for new server (e.g. mail2.domain.com)
- Create new MX records for new server (e.g. * to mail2.domain.com)
- Set priority 10 for the new server and 20 for the old, just in case the new setup fails
- Allow some time for DNS to propagate
- Connect to both servers separately (mail/mail2) and copy or import emails across
- Update A record for original mail server subdomain (e.g. mail.domain.com) to the new server IP
By having this setup, you are allowing a fallback in case the new server configuration doesn’t work properly — you are also allowing yourself plenty of time to backup/download the mail from the old server and importing it into the new one.