Moving emails from one cpanel email account to another

  • Moving emails from one cpanel email account to another

When you move your hosting to a different server you face the issue of migrating the emails from old cPanel to the new cPanel. Many a times I have seen website owner sacrificing all old mail during the server change process, because their developer does not know what to do. The fact is that it is a very easy process and can be completed before your pizza arrives.

Requirements :

  1. FTP access to both new and old server.
  2. cPanel access to the new server.

Here is a step by step approach to successfully move your cPanel mail from OLD server to NEW Server.

Step 1: Update your NameServers

You can update nameservers from your domain registrar. Go to the domain control area where you will need to change two entities from ns1. oldnameserver.com and ns2.oldnameserver.com to ns1.newnameserver.com and ns2.newnameserver.com. It takes somewhere between an hour to 24 hours to take effect. While this happens you can work on the next steps.

Step 2: Recreate email account on the NEW SERVER with the same mail id and password

Log on to the cPanel on New Server. Click the 'email accounts' icon and fill up the simple form to create the email account. Make sure to keep the password same as the one you had on the Old Server. Choose any amount of disk space you want.

Step 3: Backup the email data from Old Server

Use a FTP program like CuteFTP, filezilla or FireFTP to connect to the Old Server. From the root directory navigate to "mail/domain.com/emailAccount". There will be a lot of files there but we are interested in just two folders. Download the new and cur directories to you local machine. Save this as a back-up of your old mails.

Once you are done, log out of the FTP connection.

If you have a lot of emails this could take a while.

Step 4: Upload Email files to NEW SERVER

Log in to the New Server and like we did on the Old Server.
Navigate to the "mail/domain.com/emailaccount/" directory.
Upload the new and cur directories here by overwriting the existing ones.
Depending on the size of your mails it may take a while to upload them.

Step 5: Updating Mail Quota on New Server

We are done, you can now access your mails from cPanel. But there is one bug to be fixed. Your mail account would still show you 0MB/500MB or something like that. That's because we just created the account, and cPanel never had any records of the mails coming in. So we have to update the Mail Quota.

In the same directory where we added the email files in step 3 locate the maildirsize file. Both the server will have the file. Copy the contents from maildirsize file on Old Server to the one on the NEW SERVER.

If the above step does not work for you, try editing the maildirsize file on New Server so that it matches the values on the Old Server.

For your information:

  1. 1st row: 2097152000/1024/1024 = Available Space in B
  2. 2nd row: 1682448126/1024/1024 = Used Space in B
  3. From 3rd row they are sizes for more folders in your account.

We are done now. (Remember the Nameserver may still need some time to update. Wait for it.) Your new email account should now have all the old mails and folder exactly like your Old cPanel email account. Have fun with the emails. Send one to me as a "note of thanks".