How do you export / manual transfer emails between cPanel accounts?

View QuestionsCategory: QuestionsHow do you export / manual transfer emails between cPanel accounts?
admin Staff asked 6 years ago

I am trying to transfer cPanel accounts between servers.

Situation

  • I cannot do the backup wizard or perform full account backup. (This may be because source account is out of space OR I do not want to wipe out the entire destination cPanel account.)
  • Cannot use the mail backup function in roundcube / horde.

 

 

1 Answers
Best Answer
admin Staff answered 6 years ago

The solution is to copy files over from the source cPanel account.

  1. Copy files from source account as per instructions below.
  2. After you are done, log out of destination cPanel account once.
  3. Log back into destination cPanel account. This forces some files to refresh. If you do not do this, Roundcube / Horde may break.

 
Credit / Source: https://forums.cpanel.net/threads/exporting-email-accounts.93125/

E-mail account usernames and passwords are stored in files named passwd and shadow in the following directory structure:

/$HOME/$USER/etc/$DOMAIN/

where:

  • $HOME is the actual account home directory;
  • $USER is the cPanel account user, and;
  • $DOMAIN is the actual domain in question.

Passwords are stored in shadow in this directory in salted MD5 format. There is no way to make them human-readable, but the file can be copied and the passwords will still work.

The actual mailboxes are stored in the following format:

/$HOME/$USER/mail/$DOMAIN/$MAILBOX

where $MAILBOX is the name of the mailbox user as defined in cPanel. $MAILBOX is a directory containing all of the files related to the actual mail account data.

You can copy the files and directories from the etc and mail directories from one cPanel account to another, or from one server to another. Make sure to apply the ownerships of the destination account to the files and directories. Also, make sure to move the following files out of the way before logging into cPanel on the destination account:

/$HOME/$USER/.cpanel/email_accounts.cache
/$HOME/$USER/.cpanel/email_accounts.yaml

These files will automatically be created when you log into cPanel.