I can't restore emails from Maildir folder

Hello, everyone!

I’m newbie to VPS and Virtualmin/Webmin. I created an email account and exported/imported all the emails from the old server to the new one. Everything was ok, receiving and sending mail, but i accidentally deleted the email account, but I had backuped the “Maildir” folder.

I created the mailbox again (with the same username), stoped DOVECOT and Postfix services and then moved the Maildir backup folder (including hidden files) to the new location /home/domain/homes/mymailaccount/Maildir. Started again Dovecot and Postfix but when I go to mailbox, my emails are with the subject “unknown”, 0Kb… all of them (over 2.500). But the files in Maildir path are with their original sizes.

Can someone help me to restore my e-mails?
I’m using CentOS 7.

P.S.: I’ve googled it a lot before posting here, but couldn’t find a solution!


Hmm, do emails on other email accounts on that same server work?

Also, if you send this user a new email, does that email show up correctly in the inbox?


Hi, Erich!

Other emails accounts in the same server can send and receive.
The recreated account works fine (receiving and sending new emails) but all the previous email (those I copied to Maildir folder) seems to not work.


Hmm, can you double-check that when sending a new email to that account, that the email is appearing in the same Maildir folder where the new mail is arriving?

That is, that existing email would likely be in Maildir/cur, and the new email in Maildir/new – but I want to make sure that’s the case, and that new email isn’t going somewhere else. For example, we’ve seen occasional misconfigurations that causes new email to be delivered via mbox into /var/mail.

Also, can you try looking at a couple of the files containing your email on your new server, just to verify that it does indeed look correct?

You may also want to verify that the emails that you put into the account have permissions that the user is allowed to read and modify. If they were put there as the root user, it’s possible that they’re owned as root, rather than the user.


Eric, I have NO WORDS to thank you enough.

The problem was: I was sending the Maildir from backup to new location as root, rather than the user.

The solution: I started over all the process, creating the account again, sending the files again. And then, I went to Webmin > Others > File Manager, navigate to the folder Maildir and changed the “Ownership” of the folder to the desired user.

Thank you so much. I really appreciate your kindness!


I’m glad to hear that worked, thanks for letting us know!