Email Migration From Office 365 Outlook to cPanel

Migrating from Office 365 or Yahoo! Mail to cPanel using IMAPSync

This was considerably harder than I thought and there is very little online about migrating away from Office 365 to cPanel. This guide makes things much simpler, saving time looking up the relevant arguments and avoiding the mismatches with the names of the main IMAP folders.  You’ll need a copy of the free software: IMAPSync – used to synchronise emails to and from one server to another.

One of the issues with migrating away from Outlook with Office 365 is the slightly different folder names in use compared to IMAP in cPanel (and likely elsewhere). The arguments listed with IMAP Sync will rename these to the more common IMAP folder names.

If you use a firewall, make sure that you have an outgoing firewall exception for port 993 so that you can make the connection. Initially I didn’t spot this, very annoying!

Just want to run this for one account?

Or you can set a CRON Job to synchronise accounts at regular intervals or just use nohup to run the task in the background (if there are lots of emails):

Some tips

  • For the purpose of the transfer, use a more straight-forward password and I’ve set all the accounts to use same password while the synchronisation is live;
  • Check all the emails have made it across with Webmail as the synchronisation goes through – you can press Ctrl C in Shell to escape.
  • IMAPSync can be really, really slow, so use nohup to run it in the background (easier than CRON) and you can view the output in a log file.

Please let me know if you see anything that I can improve upon here.

Updated: 15th January 2018…

Yahoo! Mail

I’ve synchronised a Yahoo! Mail account today using the following settings:

You’ll need to disable Two-step verification and create a specific password for the transfer located in: Manage app passwords.

Updated: 5th May 2018…


For Hushmail, just use the same arguments as Yahoo! Mail with this added:

Use nohup to run in the background

If you’d like to start the process and leave it running as a separate task, you can use nohup, place the script into a file (e.g. and save the output to a text file…

Leave a Reply

Your email address will not be published.