Instructions for manual import of the emails to your CWP server.

1. Create all required mailboxes via CWP
2. Login in each created mailbox (this will create required file and folder structure)
3. Copy the emails (like any other files) in /var/vmail/DOMAIN.COM/USERNAME
4. Fix Permissions (chown uploaded files vmail:mail)

Example path for email account:

Example of rsync command from remote cPanel to local CWP:

rsync -avz -e "ssh -p 22" root@ /var/vmail/DOMAIN/USERNAME/

** This command needs to be executed on the CWP server, number 22 is ssh port.

How to Fix Permissions
Set quota and permissions for all email accounts based on the uid from the postfix.mailbox table
/scripts/cwp_api account mail_fix_permissions

cd /var/vmail/
chown vmail.mail *

How to copy email account password from cpanel server

Location of email account password on cpanel server

The password of an email account in cpanel looks like this:


* We only need the part between two colon ::
If the Password starts with:
$1$ then it is {MD5-CRYPT}
$5$ then it is {SHA256-CRYPT}
$6$ then it is {SHA512-CRYPT}

In this example we have $6$ ,edit password in the database and add this in front of it: {SHA512-CRYPT}

In the database, it would look like this


example of $1$ md5


So how to do it? go in cwp and create an email account with the random password and then edit it via phpMyAdmin or from the bash.
Password is stored in the database: postfix, table: mailbox, column name: password

Update code from bash would look like this:

mysql postfix -e 'UPDATE mailbox SET password = "{SHA512-CRYPT}$6$Tj4YOFiMG77ZE4rR$8Sf1fD/nve8ZoyMSF6JXcYW7uMuPig3PO58IYxL6OGuoxrfVBLaBztQ63RhGmxUeaWbjexiENRbyH7zW5v9ZB5" WHERE username = ""'

This instructions can be used for importing emails from any control panel, like cpanel, plesk or any other.