How to copy/move mails from cPanel to myVesta

Post Reply
User avatar
T4B
Posts: 166
Joined: Sat Jul 11, 2020 9:44 am
Been thanked: 5 times

hello how can move cpanel mails to vestacp webmail ?

Tags:
User avatar
myVesta
Site Admin
Posts: 949
Joined: Fri Jun 19, 2020 9:59 am
Has thanked: 9 times
Been thanked: 6 times

You can import the whole cpanel backup - viewtopic.php?f=24&t=63

But there is another solution.
cPanel is using the same maildir format for emails, so you can even create empty email accounts in myVesta (this is mandatory), and then simply copy those mail files from cPanel to myVesta server (destination folder will be: /home/user/mail/domain.com/emailusername/ )
After that, just delete dovecot caching files:

In your SSH, as root, run:

For specific email accounts:

Code: Select all

user=''
domain=''

Code: Select all

sudo find /home/$user/mail/$domain/emailusername/ -type f -name 'dovecot*' -delete
For the whole domain:

Code: Select all

sudo find /home/$user/mail/$domain/ -type f -name 'dovecot*' -delete
Then restart dovecot:

Code: Select all

sudo systemctl restart dovecot
At the end, you have to fix the permissions:

Code: Select all

user='myVestaUser'
find /home/$user/mail/ -type d -exec chown $user:mail {} \;
find /home/$user/mail/*/ -type d -exec chown $user:mail {} \;
find /home/$user/mail/*/ -type f -exec chown $user:mail {} \;
Instead of the user, insert the username of the account on which emails are located.
Attachments
email-routing-2.png
email-routing-2.png (21 KiB)
email-routing-1.png
email-routing-1.png (7.47 KiB)
User avatar
T4B
Posts: 166
Joined: Sat Jul 11, 2020 9:44 am
Been thanked: 5 times

Code: Select all

sudo find /home/user/mail/domaim.com/emailusername/ -type f -name 'dovecot*' -delete
sudo systemctl restart dovecot
this commands for myvestacp ?
User avatar
myVesta
Site Admin
Posts: 949
Joined: Fri Jun 19, 2020 9:59 am
Has thanked: 9 times
Been thanked: 6 times

Yes
Post Reply