![Thunderbird logo](https://assets-prod.sumo.prod.webservices.mozgcp.net/media/uploads/products/2024-02-12-07-36-53-599028_1.png)
can local mbox corruption destroy messages on IMAP server?
Hi,
A couple of weeks ago, my colleague has lost this year's emails due to an mbox corruption, probably triggered by a Thunderbird compacting operation. I know, his inbox was too large, etc. but that's not the issue here: since his account was configured as POP without leaving a copy on the server, the emails were lost and gone.
Partly in search of a solution, I am investigating a switch to a dedicated email server that supports IMAP. Yet, I'm wondering: if Thunderbird is configured to download all messages from an IMAP server, and a Thunderbird mbox file of that account gets corrupted, what will happen in terms of syncing? Will it remove all missing messages from the IMAP server (so they're lost whatsoever), or will those be downloaded again from the server?
Or, in other words: are messages on an IMAP server "safe" from possible corruptions in their local mbox storage in Thunderbird?
Many thanks for your thoughts!
Ron
Усі відповіді (8)
When an IMAP mail account is set up in Thunderbird, the e-mails are not stored locally. Just on the server. Thunderbird asks the server for the basic information of what to show in the folders, and requests the contents of an e-mail when you try to open it.
When a person moves an e-mail from an IMAP folder to Local Folders, then it downloads and saves it permanently in Local Folders. Similar to what it does with POP e-mail.
If locally stored e-mail gets corrupted, then you should right-click the folder in Thunderbird, choose Properties, and then click the "Repair Folder" button.
Also, you should always back up your Thunderbird profile folder.
If you only use IMAP, and never store your e-mails locally, then you can still lose them because the server can die.
If something is on a computer and you don't want to lose it, back it up. If you don't back it up, then you must not care about it.
Thanks for clarifying, Bruce. Perhaps I should have mentioned that I am planning to configure the mail accounts with IMAP synchronization in Thunderbird, by checking "Keep messages for this account on this computer" in Thunderbird's synchronization settings. I'm not sure if that is what you refer to with your "Local Folders" set up.
My concern is what will happen if a corruption should occur in Thunderbird's local storage of the emails which is synchronized with the mail server via IMAP. If for one reason or other, Thunderbird messes up the local mbox storage of a synchronized inbox and emails are lost, will this be considered as a deliberate removal of these emails by the email client, and will they be removed from the mail server as well, or will they be downloaded again from the mail server?
Thanks for the back-up advice as well; there's a back-up protocol in place for the server.
I suspect there is good basis for your concern. Yes, the point of IMAP synchronization is to keep a local cache copy in synch with a server, and vice versa.
I don't know enough of the mechanics to be sure exactly what goes on. But I'd believe that if Thunderbird looked into its local store and found a message missing, it would rightfully inform the server that message was no longer required and request the server to delete it. We don't know if it is state driven ("these files don't match") or event driven ("the user just deleted a message"). As an example, moving a message from its account folder to Local Folders will result in the removal of that message from the server. Whilst we have not explicitly deleted the message, the act of moving (aka copy then delete?) clearly signals an implicit delete for the server to carry out.
I know that removing a message store file in Thunderbird doesn't remove the corresponding messages on the server. The system sees that the folder doesn't exist (in Thunderbird) so sets about creating the missing file/folder by synching to the server. (Note that in the mbox system, a folder in Thunderbird is represented by a file in the OS's file system.)
The question here is whether a corrupt file looks like one in which messages have been removed, so the server is instructed to emulate it, or alternatively that the file is broken, recognized as such and then replaced by synching it. I don't know what (if any) integrity tests might be applied to a mail store file. I see no signs of any checksums, hashes or similar to confirm the contents are intact. And I don't know what happens if the filesystem reports the file to be unreadable or incomplete. One would hope the untrustworthy file would then be abandoned as unreliable, and recovery attempted by fetching from the server. But I have read that internally Thunderbird takes a somewhat casual approach to file system errors. :-(
As always, the answer is to back up. Regularly and frequently.
Thanks, Zenos, this exactly summarizes my question. And my own findings: manually touching the Thunderbird files will cause them to be considered out-of-sync with the IMAP mail server, and the synchronization process will restore the content of the mail server again in the local Thunderbird storage.
In the corrupted Thunderbird mbox file I had referred to, a whole bunch of messages was completely erased, so the question is indeed how this will be interpreted by the synchronization process (since they can be considered as "deleted" by the email client).
Should this ever occur again (not very likely I hope), potential damage should be mitigated by the daily server backups...
Just "touching" the local files causes a download from the server? That's interesting. You'd expect it to try to keep up with the most recent change, regardless of whether in the client or in the server. If you'd worked offline, marked some messages for deletion then went online, you'd expect your deletions to be honored, not overridden or ignored because they were out of step with the server copy.
Apologies, "touching" was probably the least accurate term I could have used.
I meant: manually editing the Thunderbird mbox files on the file system in a text editor, i.e. outside Thunderbird. If, for example, I close Thunderbird, open the INBOX file in a text editor, delete the first couple of messages, store the INBOX file and open Thunderbird again, those "deleted" messages aren't removed from the server, but instead are downloaded again from the server.
But of course, this still doesn't necessarily mean that an mbox corruption caused by Thunderbird will have the same effect, since such changes are written by the email client.
No, they have gone missing so they are replaced. That's a good logical fail-safe response.
If you'd changed the X-Mozilla-Status flag to an appropriate value e.g. 0x0008 then you would have triggered a deletion.
Thanks for asking this question and all the replies everyone.
So is the last message saying that the mbox file would need to specifically flag a message for deletion for it to be deleted off the server? So the likelihood of a corruption flagging messages for deletion is almost non existent and it should be fine?
I had a similar question I just asked here, with what happens if the SERVER gets corrupt or an account closed: https://support.mozilla.org/en-US/questions/1157905