Best scenario to migrate emails from CWP to cPanel

Operating System & Version
CentOS 7.9.2009
cPanel & WHM Version
cPanel 98.0.9

MotazHakim

Member
Oct 12, 2021
22
3
3
Egypt
cPanel Access Level
Root Administrator
Hello cPaneliens :)

Like the thread title

I've got a running Mail server on Centos7 with CWP (Centos Web Panel),

And now I've another server with cPanel/WHM, installed and Just created 1 account to move the emails on it and delete the CWP server

So, yesterday, I've created all emails on cPanel, and since CWP using the same mail structure, I've used rSync to move all mail directories from CWP at:
/var/vmail/domainx.com

to the cPanel account at:
/home/domainx/mail

So, all email directories moved correctly and I've fixed the permissions and ownership using WHM -> Repair Mailbox Permissions & chown command to match the cPanel mail folder ownership / Permissions

and when i tried to access any of the mails in cPanel, in the login screen, when I click login, it keeps loading and doing nothing!
and I've noticed one of the emails, in webmail Splash screens, the mail size section at the top right was about 300kb / 1024MB and that was not that mail actual size in CWP

So, moving mail dir from CWP to cPanel didn't work as expected, and I didn't watch the mail log to see what's the issue of the loading in login screen or accessing Roundcube from the welcome splash screen

for that, I've removed the cPanel account and created a new one, and I wanna migrate emails again,

So, should i do it again using rSync, with your instructions how to do it correctly this time
Bash:
rsync -avhW --no-compress --links --progress /var/vmail/domainx.com [email protected]:/home/domainx/mail
or is there another idea to do it,

And if you asking why I'm not using IMAPsync, the answer is: I need to change all emails passwords on CWP to be able to do it, and i can't do it because users are working on it.

What i think about is, using rSync, move all current emails history files to cPanel, get the encrypted email passwords from CWP MySQL Postfix DB, and put it in the shadow folder for every email ( i know how to make it work ), then Change DNS records to point to the New server IP address,

So all users won't know that migration happened !, No down time for emails

So, again, how to make it work this time using rSync ? or do you have another suggestion/ idea ?

Sorry for the long explanation.

Thanks.
 

andrew.n

Well-Known Member
Jun 9, 2020
949
351
63
EU
cPanel Access Level
Root Administrator
Well it depends on in what format CWP stores the emails. It is possible that they are in a different format and that's the reason when you move over them manually then RoundCube is having issues displaying them.
 

Daniel12345

Member
Apr 6, 2021
13
1
78
cPanel
cPanel Access Level
Root Administrator
Good day!

I would like to piggyback off of what andrew.n said and say that you must be sure that when transferring mail that any mbox data is converted to the maildir format.

You can read about manually migrating from unsupported control panels in our documentation here for more information.
 

MotazHakim

Member
Oct 12, 2021
22
3
3
Egypt
cPanel Access Level
Root Administrator
Hello
Thanks for your replies

like i said mail structure are the same, they are maildir both of them

I've found the issue, the issue in the main directory that hold all mail files have the source owner:group and permission, and " Repair Mailbox Permissions " option in WHM can't edit permissions of the domain directory in mail folder /home/accountname/mail/domain.com/email1 --< directory in red color

so emails are open correctly in cPanel now, but new issues appears now,

all email sizes shows in cPanel and in Roundcube as 0 KB/1GB , while all email have different sizes - screenshot attached
Annotation 2021-10-14 205704.png

and cPanel, keeps the usage sizes as the dafults when created

So how to force refresh email size with the actual size

a nissue, we had folders inside some emails (with Arabic names) in source, and they moved to cPanel, but with weird characters like screenshot
Annotation 2021-10-14 204948.png

So, is there any way to fix the Arabic characters in folders ?

note: inside emails itself it have Arabic subject normally, and arabic body working


----

Update 1: Regarding Actual usage of mail sizes

After a quick troubleshooting ,I've found that inside the email directory there's a file name: maildirsize
that file holds the mail actual usage size
so I've deleted it in all emails using this code while i'm in /mail/domain.com directory
Bash:
find . -name maildirsize -type f -delete
this code will delete maildirsize in all subdirectories ( emails )
then when re-login to the email again, it will create the same file with the correct usage size

So now Mail size issue Fixed, still with the Arabic folders names issue


----

Update 2 regarding Arabic Named folders

attached a screenshot, from the CWP email folders on the left, and on the right is cPanel email folders
this folders should be arabic names
Annotation 2021-10-14 220124.png
in CWP server Arabic folders names is read correctly inside email, in cPanel the same email shows the same exact name as shown in SFTP

---
I've tried to create a new email arabic named folder in roundcube, and checked the SFTP to the email folders, i've found that cPanel is putting the same exact folder name in arabic, not like CWP!

So, do you think the issue is from the source ( CWP ) and how it handle arabic named folders ?




So i think the issue on cPanel or something related to characters encoding, Any ideas ?
 

Attachments

Last edited:

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
14,260
2,220
363
cPanel Access Level
Root Administrator
Can you try the details mentioned here to see if that is also the case on your machine?

 

MotazHakim

Member
Oct 12, 2021
22
3
3
Egypt
cPanel Access Level
Root Administrator
Interesting - I'm not sure what else would cause that behavior. Could you create a ticket with our team so we can do some deeper investigation into this?
Sure, but let me think with you about :

in cPanel, if i created arabic name folder in mail, it will create an arabic directory in the mail directory
in CWP, if i created arabic name folder in mail, it will create that directory named".&BjkGJwZF- - &BiMGLgYx-" in mail directory

So, maybe CWP didn't handle UTF-8 correctly in the first place, and cPanel acts normally when i migrate email folders , so with a directory named ".&BjkGJwZF- - &BiMGLgYx-" then it will show it with same name, because cPanel set's UTF-8 Correctly, so this directory named: ".&BjkGJwZF- - &BiMGLgYx-" is a real name for cPanel/roundcube !!

think about it !