Import Emails From Plesk To CyberPanel

I was recently switching to a new server (CyberPanel) from an old server (Plesk). I wanted to bring over all emails I had from my old server to the new.

So for example, I had email1.com and email2.com on Plesk, and created email1 and email2 on CyberPanel. Now I just needed to bring over all of the emails.

On both servers, in the terminal, we will have slightly different directories.. but both will have Maildir (as you’ll soon see).

ls /var/qmail/mailnames/mywebsite.com/
ls /home/vmail/mywebsite.com/

Go even further on either, for mail directory:

ls /var/qmail/mailnames/mywebsite.com/email1/Maildir
ls /home/vmail/mywebsite.com/email1/Maildir

We for sure want to transfer cur, new, and sent.

You will be transferring from the old server terminal (change your domain, email account, and new server IP address accordingly)

rsync -avz /var/qmail/mailnames/mywebsite.com/email1/Maildir/cur root@ip-address:/home/vmail/mywebsite.com/email1/Maildir

You will notice that we are transferring /Maildir/cur to the new server /Maildir (without the /cur). This is intentional.. if we added /cur to the second line, it would create a second directory.

Now we can just use the same command but change to /new and /.Sent to import those emails over.

rsync -avz /var/qmail/mailnames/mywebsite.com/email1/Maildir/new root@ip-address:/home/vmail/mywebsite.com/email1/Maildir

You might notice that /.Sent has it’s own directory just like /Maildir. It has cur and new that we can transfer over too.

ls /var/qmail/mailnames/mywebsite.com/email1/Maildir/.Sent

It’s a similar process..

rsync -avz /var/qmail/mailnames/mywebsite.com/admin/Maildir/.Sent/cur root@ip-address:/home/vmail/mywebsite.com/admin/Maildir/.Sent

One Last thing

If you were to check your CyberPanel inbox at this point, you will not see any emails. They are there, but you’re having permission errors.

Once the emails are transferred over to CyberPanel, we have to change the ownership. It’s as easy as:

chown -R vmail:vmail /home/vmail

That’s it! If you have any questions, just leave a comment and I can try to help.

Subscribe
Notify of
0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments