• Plesk Uservoice will be deprecated by October. Moving forward, all product feature requests and improvement suggestions will be managed through our new platform Plesk Productboard.
    To continue sharing your ideas and feedback, please visit features.plesk.com

Issue Mail duplicated but not...

pacosrfs

New Pleskian
Hi, nice to meet you all. Let´s see if i can explain this: I migrated a domain to a new vps and imported an email account with about 10gb of content. In this new account there was a problem and i had to delete it but i forgot to delete the emails. The result was that when i re-imported it again, i got 20gb of emails.

Is there any way to delete the former emails o do i have to delete all of them?
Thank you all
 
There is a way, but it is complicated and risky. You might end up with inoperational mailboxes. Do this at your own risk. I assume no liability for any data damage that can result from interfering with the email storage algorithms manually.

1) Check /var/qmail/mailnames/<domain>/<email name>/Maildir/cur and /new what timestamp the individual mail content files have. If all "old" duplicates have a timestamp "older than n days" compared to the new, you can use a command like
# find ./* -mtime +n -exec rm {} \;
to remove all the files older than n days, so that only the "new" imported files are left. So you can get rid of the duplicates.
If the files cannot be grouped by age, e.g. if your import has restored the original file timestamps, you cannot get rid of the duplicates.

In any case, (1) will destroy the index of the mailbox.

2) So if you should succeed in (1), you need to rebuild the index of the mailbox. This could work:
# doveadm -D force-resync -u <mailboxname (email address)> '*'
Proceed only if this does not display errors.
# doveadm fts rescan -u <mailboxname (email address)>
# doveadm index -u <mailboxname (email address)> '*'

Again, no liability for any damages this might cause. I think it's a risky thing to do.
 
Hi Peter, thank you for your answer. As you said, it´s quite a risk XD
I think i will try to delete all of them directly and start again.
By the way, do you know a method to ensure the emails deleting. The first time i deleted the mailbox and recreated but i think the emails weren´t erased (hence this whole problem).
Sorry for the trouble and thanks for your help.
 
Back
Top