Server Webmail Migration Guide – cPanel to cPanel

Moving email folders to a new server during a server migration ought to be easy. Email migration should be as easy as pressing a button in cPanel’s Backup Wizard. But, oh no, cPanel offers no such automated email export option. And it is! [Thank you, Valentin, for letting us know in the comments].

In cPanel we can make a full backup of a server account. This back up stores emails and email account information in the directory homedir/mail/. But, what do we do when we want to move emails from one server to another without taking a full back up of the server space? How do we migrate webmail emails between a server when the origin server has multiple addon domains or when we want only the emails and no other data?

Here is a quick and easy way to export all emails from one server and import them into another.

Assumptions

  • The domain name of the email accounts has not changed.
  • The new web server is devoid of emails for the email accounts being moved to it. The email restoration process deletes existing email profile data.
  • Both servers use cPanel & Dovecot. Dovecot is usually installed with cPanel. This email migration process can be adapted to non cPanel server management software. This guide provides instructions for backing up and restoring emails for cPanel accounts only.

Server webmail migration guide

Step 1: Backup and download email folders

In this step we create an export file that contains the emails stored on server 1. This will be our email backup file.

  1. Login to cPanel on server 1
  2. Open File Manager
  3. Go up one directory above public_html (see image 1)
  4. Enter the mail directory (see image 2)
  5. Right-click the directory with the same name as the domain the emails belong to (see image 2)
  6. Compress the directory
  7. Download the compressed file. You might need to reload the directory to see it

The ‘mail’ directory contains subdirectories for each email domain. Each subdirectory is named after the domain the emails belong to. Every subdirectory with a domain name contains mail folders for that domain. For example, the emails for all of JournalXtra’s email addresses are stored in /mail/journalxtra.com e.g. /mail/journalxtra.com/webmaster and /mail/journalxtra.com/noreply.

Step 2: Restore email backups

In this step we import the email backup file into server 2.

  1. Login to cPanel on server 2
  2. Use cPanel to recreate the email accounts (see image 3)
  3. Open File Manager
  4. Go up one directory above public_html (see image 1)
  5. Enter the mail directory (see image 2)
  6. Upload the email backup file
  7. Unzip the file
  8. Delete the zip file
  9. Open webmail
  10. Configure Webmail to show the new email folders

We recreate the email addresses on server 2 before we unzip the backup file because otherwise cPanel deletes the migrated emails when new accounts are created.

Email migration can be easy

Email migration between servers is straight forward. Create an email directory export file. Recreate email accounts on the target server before uploading the export file. Upload the export file to the target server.

The webmail migration method explained above here works when the domain name of the source server is the same as the domain name of the target server. I’ve yet to migrate email accounts between two servers with different domain names but I figure in such a case I could use sed or awk to rewrite the source server domain name written in the export file.

Do you know of an easier way to migrate email boxes between servers?

Sharing is caring!

18
Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  Subscribe  
newest oldest most voted
Notify of
Valentin

“But, oh no, cPanel offers no such automated email export option. But, worry not because..”

I’m afraid that you are wrong. A full backup performed in cpanel saves the emails too. They are stored in “homedir” under the folder called “Mail”.

Me

I have to migrate some mail from another control panel into cPanel , any tutorial on that ? my servers run on CentOS 6 with cPanel while the old server runs on KonsoleH (hetzner)

DG G

Hello Me, you can use a simple program in linux “ImapSync” to migrate from one IMAP server to another.

imapsync –host1 server1.example.com –user1 [email protected] –passfile1 /etc/secret2 –host2 server2.example.com –user2 [email protected] –passfile2 /etc/secret2

Cheers!

Jef

y si es al contrario quiero que los que tengo en el servidor esten en cpanel o sea colocarlos todos en el cpanel pero sin eliminar los del correo o es posible que lleguen a los dos’? seria de mucha ayuda si me respondieran

bhavin

Hello , I’m following this tutorial for back from cpanel-1 to cpanel-2 but now i’m dealing with a issue.

If i’m making a new email address under abc.com domain so let’s take example.

[email protected] so in abc.com folder there is a folder 123.
Now i have a zip file from cpanel-1 with same name 123 so 123 folder is already exist there (In mail directory) so we have to replace it or we have to remove 123 and then unzip 123.zip (which backup from cpanel-1)

You do not need to delete the files. All you have to do is to copy the folder. It will only upload new files and the older files will be safe.

Thanks for a very clear explanation. Having moved servers, but before changing the DNS, I was wondering how to transfer the emails from old to new accounts using cPanel. You saved the day – I downloaded a compressed file of the requisite folder in /mail, renamed the folder in the new account and uploaded the zipped file. Then extracted the zipped folder and checked (using Squirrelmail) and all the new emails were there.

Great advice

jack reacher

GREAT ADVICE Server Webmail Migration Guide cPanel to cPanel JournalXtr

Thanks bro, I need this article. and you written a good about cpanel mail migration.
Thanks again.

Baretto James

I did a file server migration from old to new server and it was not easy, many errors and many bummers. My friend suggested me to use GS Richcopy 360 which helped me alot in solving those bummers. I dont have to worry anymore, this software handles it for me!

Roman

If you need a migration solution to migrate all your data (mailboxes, SharePoint sites, Google Sites, Google Drive, OneDrive) between Google and Office 365, here is a SAAS solution: http://www.cloudiway.com/

Guru

Thanks for a very clear explanation.

Bridgett

Thank you so much, this worked perfectly even 3 years later!

Harish Peswani

Does this work if I need to transfer mails from a Linux Server to a Windows Server. i.e. from a server using CPANEL to a server using PLESK PANEL.

Steve Smith

Recently, I have used ZOOK Email Backup Software which allows me to take backup of emails from webhost mail, cloud and other webmail services. It easily creates backup of emails from popular webhost services such as HostGator, GoDaddy, Bluehost, etc. to computer.

For More Info: – https://gallery.technet.microsoft.com/Email-Backup-Software-64c8b58f

Calorina John

Thanks to ZOOK Email Backup Wizard which successfully creates a backup of my thousands of email accounts. I am truly impressed by the performance of the tool which easily export emails from webmail or cloud mail to various saving options.
It has the efficiency to transfer emails from 75+ Email applications into 26+ saving options.

Thanks to the Team for this superb tool!!!

roy

I tried these tips/steps, no errors or whatsoever, the mailbox size increased (exact same size with the old hosting). But when I opened the inbox for the email account that I backed up, it’s empty, all folders are empty.

shares