All Emails disappeared after compacting

User Help for Mozilla Thunderbird
peters220
Posts: 10
Joined: January 18th, 2020, 8:41 am

All Emails disappeared after compacting

Post by peters220 »

Hello All; I use Thunderbird IMAP with gmail. While doing the normal weekly sorting to folders and deleting emails that I don't want to keep I noticed that some emails that I would move to a folder (not copy to a folder) from the Inbox would reappear back in the Inbox. I checked that the emails were moved to the new folder and then I deleted the ones that kept coming back. Thunderbird has never done this before. After completing I was asked if I wanted to compact. I clicked on yes just as I have many times before. After compacting "All" Emails were gone. All of the folders were still there but are empty. After searching for a way to get the emails back the only thing I tried was the repair button of the folders. That did nothing. I looked at my profile folder file sizes but there are only a few bytes in each and a few kilobytes in some. There is 199 meg in the cache. It also synced with my phone and there are no emails on my phone. How do I recover the emails? Thanks JP
User avatar
tanstaafl
Moderator
Posts: 49647
Joined: July 30th, 2003, 5:06 pm

Re: All Emails disappeared after compacting

Post by tanstaafl »

I suggest you use a browser to log into webmail and see if the missing email are displayed by it. If not, see if they are in the trash or all mail folder. If they're there, then you can move them to other folders, where Thunderbird should see them. Normally what you see in a remote folder and the corresponding webmail folder are the same, but that depends upon your webmail settings. You have nothing to lose by checking.

https://support.google.com/mail/answer/ ... ktop&hl=en

Compacting is normally a good way of doing preventative maintenance. But if the folder is fairly corrupt its possible for it to be very destructive due to it physically removing messages that were not marked as deleted, caused by it thinking they were part of another message. I'd normally expect this to be a problem for POP accounts, not IMAP, since Thunderbird normally uses the remote folder as the master when syncing.

Check the "local directory" in the server settings for the account in your profile. If something made it change the location Thunderbird would create new empty folders for all of the "special" folders such as the inbox. You'd also lose any non-standard folders that you manually created.

I suggest you also try setting "when I delete a message" from "move it to the trash" to "just mark as deleted". That will list any messages that were marked as deleted and hidden from view (after it copied them to the trash folder), with a line drawn through them in the folder listing (if compacting didn't permanently remove them)

See http://kb.mozillazine.org/Empty_folders for other suggestions.
User avatar
tanstaafl
Moderator
Posts: 49647
Joined: July 30th, 2003, 5:06 pm

Re: All Emails disappeared after compacting

Post by tanstaafl »

"There is 199 meg in the cache"

Any mbox files in it? They are text folders named after the folder, with no file extension. They are used to store messages for a folder. For example "inbox." is the mbox file for the inbox folder. If they exist you could use the ImportExportToolsNG add-on to import them into "Local Folders", and then move them afterwards. Ditto for any *.eml files (individual messages). I'm configured to have a empty disk cache so I'm out of date on whats in it.
tsor
Posts: 245
Joined: December 14th, 2004, 12:17 am
Location: Island of Kaua'i

Re: All Emails disappeared after compacting

Post by tsor »

Before you fiddle with the ImportExportTools ... I used 'recuva' ... few clicks and one new folder on the desktop ... success ... Data [single mail] recovered. But this was a POP3 account.
peters220
Posts: 10
Joined: January 18th, 2020, 8:41 am

Re: All Emails disappeared after compacting

Post by peters220 »

Thanks for the quick replies. tanstaafl---I logged on with web browser and it is the same as Thunderbird. The only emails were new. I got back onto Thunderbird and sorted and deleted as usual with no problems. I don't know what is in the cache because I don't know the file name and it's location. I do remember that the compact dialog said I could save 70 mb of disc space. tsor---I tried Recuva and did not see anything that seemed to be related to Thunderbird. I don't think that the files were deleted by Thunderbird. I think that Thunderbird lost track of them. Thanks JP
User avatar
tanstaafl
Moderator
Posts: 49647
Joined: July 30th, 2003, 5:06 pm

Re: All Emails disappeared after compacting

Post by tanstaafl »

My impression is that Recuva can do a good job of recovering deleted files, but its not really designed to recover text that has been deleted from a existing file. That's what occurs when a folder becomes empty since the mbox file still exists afterwards. For that you want something more like disk sector editor that lets you search for specific text in the disk sectors that have been freed from files.

If you think Thunderbrid just lost track of the files use a desktop search tool like Everything to search for all files named "inbox.". Than compare their locations with the local directories used by your accounts. It is much quicker than using the built-in search in windows explorer etc.
peters220
Posts: 10
Joined: January 18th, 2020, 8:41 am

Re: All Emails disappeared after compacting

Post by peters220 »

Thanks tanstaafl; I will give it a try. I read that deleting the msf file for each each folder rebuilds the index for that folder. Is it something that I should try? Thanks JP
User avatar
tanstaafl
Moderator
Posts: 49647
Joined: July 30th, 2003, 5:06 pm

Re: All Emails disappeared after compacting

Post by tanstaafl »

You're better off right clicking on the folder in the folder pane, selecting properties and then pressing the repair folder button. That rebuilds the folder listing too, but also preserves some message flags that are stored only in the *.msf file. I'd try it for the inbox. If that doesn't help (because the messages are not in the remote folder), no sense doing it for other folders.
peters220
Posts: 10
Joined: January 18th, 2020, 8:41 am

Re: All Emails disappeared after compacting

Post by peters220 »

Thanks tanstaafl; I tried that and it did not do anything. Thanks JP
User avatar
tanstaafl
Moderator
Posts: 49647
Joined: July 30th, 2003, 5:06 pm

Re: All Emails disappeared after compacting

Post by tanstaafl »

Unfortunately, I think you are out of luck if you couldn't find any other copies of the mbox files. Just to be clear, you used either windows explorer's search or something like Everything to search for those files, you didn't just repair the folder listings?

I am still puzzled why the compacting deleted messages in the remote folder as I'm used to it making the local/offline copy mirror whats in the remote folder, not vice versa. For example if I replace the "inbox." file with one that has a copy of all of the messages in the remote folder plus has some additional messages when it syncs it deletes the "inbox." file, creates a new empty one and then fetches messages from the remote folder as needed to make it mirror the contents of the remote folder. All of the "additional" messages are lost, they're not copied to the remote folder.

Since this problem might occur again I suggest you consider either disabling offline folders (UNcheck "keep messages in all folders for this account on this computer" in the accounts synchronization & storage settings so that there is no local copy to sync, or start doing backups of the profile. One easy way is to configure the ImportExportToolsNG add-on to do scheduled backups of the entire profile for you. That is different from using it to import/export mbox files, which is what most people use it for.
peters220
Posts: 10
Joined: January 18th, 2020, 8:41 am

Re: All Emails disappeared after compacting

Post by peters220 »

Thanks tanstaafl: I have not done the search yet. I will search with a this I have been using it for years. Thanks JP. http://www3.sympatico.ca/paulscott/find.htm
User avatar
tanstaafl
Moderator
Posts: 49647
Joined: July 30th, 2003, 5:06 pm

Re: All Emails disappeared after compacting

Post by tanstaafl »

FYI the paid version of MalwareBytes 4.0.4.49 claims that web site has a trojan.
peters220
Posts: 10
Joined: January 18th, 2020, 8:41 am

Re: All Emails disappeared after compacting

Post by peters220 »

Thanks tanstaafl: Am scanning for malware now. Avast gives no notification. I started using "Find" about 15 years ago. Just searched for the website so that I could post the link. I scanned the Find zip file and found nothing. If you think that the site is a real threat feel free to remove the link. Thanks JP
User avatar
tanstaafl
Moderator
Posts: 49647
Joined: July 30th, 2003, 5:06 pm

Re: All Emails disappeared after compacting

Post by tanstaafl »

https://support.mozilla.org/en-US/questions/1277737

There are several threads like that were all of the emails appear to disappear, but are just not being displayed due to a corrupt global-messages-db.sqlite file. The workaround is to delete the global-messages-db.* files in your profile and restart Thunderbird. It will rebuild the database. That doesn't seem to apply in your case (since the messages are physically gone) but it wouldn't hurt to try it in case you made a mistake. The global search/indexing database file needs updating anyways if all of the messages disappeared behind its back.
peters220
Posts: 10
Joined: January 18th, 2020, 8:41 am

Re: All Emails disappeared after compacting

Post by peters220 »

Hello tanstaafl: The search took about a day and one half. The emails all seem to be in the correct places "Inbox" "Trash" ect. With one exception. There is a "cache" and a "cache2". The emails seem to be listed under a very long number-letter combination. I will try your latest suggestion. If that fails I will need more specific instruction on how to get Thunderbird to recognize them again. Thanks JP
Post Reply