Thunderbird deleted all mail on Inbox folder after asking to "compact folders"
Thunderbird asked to compact folders saying it would save hundreds of MBs of disk space, I accidently clicked "compact now" instead of just ignoring it as I usually do. As a result, Thunderbird deleted all mail on my Inbox folder - after restarting Thunderbird, my inbox was empty, I also checked the mail folder on my file explorer and the "Inbox" file (no extension) was just a few KBs, whereas previously to Thunderbird deleting it was several MBs. There were no errors reported during the "compact" process.
I don't think I can recover the mail that Thunderbird deleted because the mail server does not seem to keep mail older than 12 months. One of the reasons I used Thunderbird was to be able to keep a local copy of older emails.
The pop-up I received was the one shown in this article by Mozilla: https://support.mozilla.org/en-US/kb/compacting-folders
The article explicitly says "compact" does not delete mail, but then explains that it actually does (by not moving mail "moved or marked as deleted" to the a new file, and deleting the old file). I had no such "marked as deleted" mail. It was just plain read mail on my Inbox folder.
This is an Office 365 POP account. Thunderbird's retention policy for the Inbox folder was to use my (Thunderbird) account's policy, which was to never delete any mail. Alas, when I hit "compact now", Thunderbird deleted all my mail. I was running Thunderbird 91.6.1 on Windows 10.
I tried making a backup of all Thunderbird related folders and deleting the "popstate" file to download all mail from the server again. Mail got downloaded, but not all - as I mentioned, the mail server only returns 12 month worth of email, whereas I had years of mail stored locally. I don't see any way of recovering it... Why would Thunderbird just delete all mail calling it "compact"? Makes no sense...
ప్రత్యుత్తరాలన్నీ (3)
PS: I do not have any anti-virus software installed apart from Windows Defender which is default, I checked the logs and there is nothing about removing Thunderbird files.
re : I had no such "marked as deleted" mail.
Anyone who has moved or deleted an email will have hidden 'marked as deleted' emails.
When you download emails they are written one after the other to an mbox text file document which has the same name as the folder you see in the Folder Pane.
When you move or delete an email, it will appear to be moved to the designated folder. However, the original email will still be in the original folder, but now it is hidden and been 'marked as deleted' .
When compacting occurs, all good emails - those not hidden and marked as delected are written to new file. All those that are hidden and marked as deleted remain in old file. The new file then replaces the old file.
Compacting is a basic good housekeeping maintenance practise which helps to keep a healthy file, not full of old previously moved and deleted emails. However, it sounds like you have not been compacting as you say " I accidently clicked "compact now" instead of just ignoring it " - so over time the Inbox file can end up with more deleted stuff than good currently used emails. It is also more likely to get corrupted.
re : As a result, Thunderbird deleted all mail on my Inbox folder - after restarting Thunderbird,my inbox was empty,
Whilst compacting is being performed Thunderbird must be running and remain running until it is finished because it is opening files and copying data to new files before replacing them and it is doing this on all files. You say "after restarting Thunderbird,my inbox was empty" Do you think you may have exited Thunderbird whilst it was still compacting all your folders ? Why did you restart Thunderbird ? Did you only discover emails gone after restarting Thunderbird ?
Do you have a backup?
If you still see this problem please post an update.