Backup of email account on cPanel server

While recreating the E-mail account its always good to take the backup for existing E-mails, so that we can easily restored e-mails under the newly created E-mail account. To create the E-mail account backup login in to the shell as a root user and follow the steps one by one.

cd /home/cPanel-user/mail/your-domain-name.com
mkdir emailbackup

cd email-account-for-which-you-want-backup

cp -p * ../emailbackup -R

Now check all the E-mails are copied under the emailbackup or not.

ll /home/cPanel-user/mail/your-domain-name.com/emailbackup

If all the E-mails are copied successfully than delete the E-mail account from the cPanel and recreate the E-mail account as per your requirement from cPanel

cPanel >> E-mail Accounts >> create E-mail account

Now restore the E-mils under newly create E-mail account.

cd /home/cPanel-user/mail/your-domain-name.com/emailbackup

cp * ../new-e-mail-account -pR

want to replace – type “yes”

Now check all the e-mails present under the new E-mail account or not and if you have any problem run the following script to correct the permission ownership for E-mails.

/scripts/mailperm –verbose