Exporting email accounts

bronwerkz

Registered
Sep 16, 2008
2
0
51
Hi there, I would like to find out how to export the whole mail account from a specific domain. Meaning

abc.com > MAIL accounts > [email protected], [email protected], [email protected] [email protected] [email protected]

Exporting the full account info including the passwords.

I want to migrate to another better cpanel based hosting but do not want users to go through the trouble of changing their mail passwords and settings of their mail clients. The mentioned account is an add on domain in cpanel.

Anyone care to advice please? :D
 

cPanelDavidG

Technical Product Specialist
Nov 29, 2006
11,216
11
313
Houston, TX
cPanel Access Level
Root Administrator
Hi there, I would like to find out how to export the whole mail account from a specific domain. Meaning

abc.com > MAIL accounts > [email protected], [email protected], [email protected] [email protected] [email protected]

Exporting the full account info including the passwords.

I want to migrate to another better cpanel based hosting but do not want users to go through the trouble of changing their mail passwords and settings of their mail clients. The mentioned account is an add on domain in cpanel.

Anyone care to advice please? :D
If this is part of a migration process of moving an entire cPanel account from one server to another, just make a full site backup and have your new hosting provider restore this backup. This will back up all data (including email, email accounts, passwords etc.) and will make the migration to the new server very easy.
 

bronwerkz

Registered
Sep 16, 2008
2
0
51
Hey david thank you for your reply but sadly no, this is not a full cpanel account migration. I just need to move one of the add on domain name under the main account to another shared hosting provider.

Anyway i can do the mail account migration on the add on domain?
 

cliffvt

Registered
Apr 20, 2011
1
0
51
Has anyone figured out how to do this? My cPanel host cannot help me and has told me to write a PHPscript... Nice one! I need to move email addresses, plus passwords etc. to a new server. Thanks!
 

cPanelDavidG

Technical Product Specialist
Nov 29, 2006
11,216
11
313
Houston, TX
cPanel Access Level
Root Administrator
Has anyone figured out how to do this? My cPanel host cannot help me and has told me to write a PHPscript... Nice one! I need to move email addresses, plus passwords etc. to a new server. Thanks!
You are just moving email accounts, not an entire cPanel account? Are you moving to another server running cPanel&WHM?
 

JaredR.

Well-Known Member
Feb 25, 2010
1,834
23
143
Houston, TX
cPanel Access Level
Root Administrator
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.
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
37
248
somewhere over the rainbow
cPanel Access Level
Root Administrator
The files should be owned by username:mail for /$HOME/$USER/mail/$DOMAIN/$MAILBOX path, so something like:

Code:
cd /$HOME/$USER/mail/$DOMAIN/
chown -R username:mail $MAILBOX
Where /$HOME is where you have your /home directory (normally, this is just /home itself), $USER is the cPanel username, $DOMAIN is the domain name, and $MAILBOX is the email account username.