Move email accounts from one cPanel account to another

Moving email accounts along with all emails from one cPanel to another can be done in two ways:

  1. IMAPSync – you need access to a terminal and passwords for email accounts
  2. FTP (File Manager) – you need access to FTP or cPanel File Manager on both cPanels

Migrating email accounts from one cPanel to another using cPanel File Manager

I recommend this option for non-tech users as all you are doing is creating new email accounts and then copying emails to them.

Step 1. Create a new email account on the new server

On the new cPanel server navigate to Email accounts and create all the email accounts that you wish to migrate. If you don’t know the passwords, but want to keep them the same as on the old host, then just set a random password now, and later in step 4. you can copy the old password from the old cpanel.


Step 2. Download emails from the old server

In cPanel emails are stored for each account under mail/DOMAIN/EMAILACCOUNT, for example, emails for account [email protected] are stored under mail/pcx3.com/info

To copy those emails, simply open this folder from cPanel File Manager and create an archive from both the cur and new folders.

Then download this archive to your computer.


Step 3. Upload files to the new server

Go back to the new server and navigate from File manager to the same directory mail/DOMAIN/EMAILACCOUNT then upload the downloaded archive here.

Delete the cur and new folders

then extract the uploaded archive.

Once it is done, you will have all the emails from the old server.


Step 4. (optional) Copy passwords from the old server

Passwords are stored encrypted in cpanel so you cant really see them, but you can copy them. They are stored in mail/DOMAIN/EMAILACCOUNT so if you want to keep all passwords the same, just copy these files from the old server to the new one.


Step 5. Change DNS so that new emails can be received on the new server

A mail exchanger record (MX record) specifies the mail server responsible for accepting email messages on behalf of a domain name. Once we have copied all the emails, we have to point the MX record to the new server, so that new emails get delivered there.

To change MX record, you have to enter the DNS zone of your domain and change this record.

https://developers.cloudflare.com/dns/manage-dns-records/how-to/email-records/

For instructions on how to do this please contact your hosting provider.


Migrating email accounts from one cPanel to another using IMAPsync

imapsync is an IMAP transfer tool that can be used to copy emails from one server to another. this tool has to be installed on a Linux server before it is used, but you don’t have to install it on either new or old server. For example, you can install it locally on your Linux OS.

First, install imapsync

yum install epel-release
yum install imapsync

Then migrate emails using the following command:

imapsync --host1 'mail.server1.com'  \
	   --user1 '[email protected]' 	    \
	   --password1 'password'  	    \
	   --ssl1			    \
	   --host2 'mail.server2.com'   \
	   --user2 '[email protected]'	    \
	   --password2 'password'  \
	   --ssl2 

Replace information per your need:

mail.server1.comOLD SERVER
mail.server2.comNEW SERVER
[email protected]EMAIL ADDRESS
passwordEMAIL PASSWORD

And run the command in the terminal. It will go through all folders and copy all emails one by one.


whoami
Stefan Pejcic
Join the discussion

I enjoy constructive responses and professional comments to my posts, and invite anyone to comment or link to my site.