Double and Triple IMAP messages in Thunderbird MBOX File

I want to use the data contained in the Thunderbird profile folder of an IMAP account for email backup. Therefor I seek predictability as a precondition for reliability in terms of email restoration. To this end I conducted a restoration test and now find that I have several mails manifold restored in TB.

These are the details of the test in timely order of their occurrence:
I

  • in TB subscribed to all folders
  • untoggled
    • “Keep messages in all folders for this account on this computer”
    • “Don´t download messages larger than” (under “Synchronization & Storage > Advanced…”)
  • chose all of the desired folders “for offline use” (under “Synchronization & Storage”)
  • toggled “Synchronize all messages locally regardless of age”
  • shut down TB
  • sent a message, labelled 4, from some email account (at mail provider GMX) to the actual email account (different mail provider), using therfor the provider´s front end with a web browser (i.e. not a dedicated mail client)
  • started TB
  • marked the (received) message 4 in the junk or spam suspect folder in TB as being “not spam” because the message had wound up just there; TB at that automatically moved the message to the Inbox folder
  • dragged this message 4 from Inbox into a folder named C (of the same email account)
  • shut down TB
  • sent three messages, labelled 6, 7 and 8 (using the same method as before with message 4)
  • on the web interface of the actual email account dragged message 7 from the Inbox folder into a folder named A (obviously of the same email account)
  • started TB
  • dragged message 8 in TB from the Inbox folder into a folder named B (of the same email account)
  • took notice of all four messages being unique each (i.e. no duplicates anywhere) and still being marked “unread”
  • shut down TB
  • copied the mbox files of the IMAP account from the profile folder of my working TB installation, once with and once without the corresponding *.msf files, to folder Local FoldersAcnt (in “[path of profile folder]Mail”) of a separate TB installation on a virtual machine; I had taken care to delete every file and folder in Acnt before copying these files
  • started TB on the virtual machine

The result of the “restoration” of the emails on the virtual machine is (other than the presense of some headers in TB as provided by the *.msf files and the recognition by TB of several folders as being special, like Junk folder e.g., either which is as expected, the result when copying also the *.msf files is the same as when not copying them):

  1. message 4 is trifold present, twice in the Inbox folder and once in folder C (should be in C only)
  2. message 6 is double in Inbox (should be only once)
  3. message 7 is solely present in folder A (as should be)
  4. message 8 is double, once in Inbox and once in folder B (should reside only in the latter)
  5. none of the hundreds of other messages are manifold present
  6. the messages 4, 6, 7 and 8 and all their copies are marked “read” right from the start (which they shouldn´t)
  7. messages 4 and 6 are each stored double in the mbox file corresponding to Inbox as well (which is in accordance with the observations described above), while the copies featuring the exact message-ID of their originals and deviating approx. 4 minutes from the time stamp (i.e. “Date:” header) of the originals each
  8. each and every copy and original of the messages 4, 6, 7 and 8 has “X-Mozilla-Status: 1” in the mbox files

However, when I

  • compact the folders of the IMAP account in TB
  • copy the mbox files from the original TB installation to the TB installation on the virtual machine like done before (see above description)
  • start TB on the virtual machine

the result (on the virtual machine) is

  • no more manifold message in TB (as should be)
  • the messages 4, 6, 7 and 8 and all their copies are marked “read” right from the start (which they shouldn´t)
  • the messages 4, 6, 7 and 8 reside in their proposed folders each (as should be)

The result from compacting the folders suggests all but one of the copies of the messages 4, 6 and 8 having been marked “deleted”. Telling from the “X-Mozilla-Status” set to 1 however they have been merely “read” but in no way “deleted”, yet they are no longer present in the mbox files after compacting, and they aren´t displayed in the original TB installation. Thus I deduce that TB must store the information about which messages are to be obliterated (and thus not to be displayed but to be removed from the mbox files during the next compacting run) someplace other than in the mbox files and also than in the *.msf files.

Since try compacting IMAP folders after the fact, i.e. under restore conditions (and hence offline), is futile:

What can/must be done to restore the IMAP mails from the profile folder such that at least there is no manifold message occurrence?
As an application example, imagine that some day the connection to the mail server for any reason cannot be established so one has no chance of prior compacting. I´d want to have all emails assigned to synchronization restored from the profile folder, completely, neatly and without excessive effort. And without having the same emails spread over all possible folders.

I have seen a lot of posts dealing with TB backup, I haven´t found one however to dig into how to obtain a sophisticated backup from the profile folder while addressing this issue. I am neither going for a filters-and-Local-Folders nor a use-additional-software solution.

Installation specifics

  • TB 140.3.1ESR both with original TB installation and with TB installation on virtual machine (VirtualBox)
  • Windows 10 both on corporeal PC and on virtual machine