Question

I recently setup mail server using zpanel (with dovecot and Maildir format) for my domain and created a user email account with user@my-domain.com here.

Here all the emails are stored in following tree in server under /var/zpanel/vmail/ path

my-domain.com
  |--> cur/
  |  ------
  |--> new/
  |  ------
  |--> tmp/
    ------

I have all user email from my old server (in same format as above). Where email server for my domain my-domain.com was be hosted before.

Problem is, I already have few emails on new server for user and I want to merge both so that it show up all email which I sent from New email server and old one.

Is there any way, I can merge these two maildirs?

Was it helpful?

Solution

Sorry, But I figured out how we can do it. Just answering my question here so that will be useful for others as well.

We can do it using simple filesystem merge for directories but after that we need to make sure that we give appropriate permission to all files for vmail user (user might be specific to zpanel).

This is what worked for me . Under /var/zpanel/vmail/my-domain.com/cur/:

$ sudo chown vmail:mail *

Same we need to do for /new and /tmp directories.

OTHER TIPS

You can use cp -Rp to recursively copy folder contents while maintaining ownership and permissions and then delete the old folder.

For example, to merge "INBOX/something" to "INBOX" with dovecot:

# from the dovecot mail folder
cp -Rp .INBOX.something/* ./
rm -rf .INBOX.something
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top