After installing Catalina macOS I (along with lots of other people) lost a whole swag of mail; the problem seems to occur after moving a message between mailboxes, possibly before Mail had finished updating itself, but may have other triggers. Many messages simply went totally missing, and lots of message (in custom mailboxes) are shown with a header but no content. Remedies suggested in various fora haven’t worked: rebuilding mailboxes didn’t help, even with manual removal of the Mail.app Envelope databases, and Time Machine cannot be used at least in its in its simple mode to recover mail. With over 85000 emails and the byzantine directory structure of the email messages, there is no way I can manually search for the missing email in the backups.
I am writing a stack to create a custom sqlite database of messages from the standard Mac ~/Library/Mail location, and from Time Machine backup locations, and include tools to compare and find emails. So far it seems to be successful in finding lost messages; I have yet to add tools to reimport to Mail.app.
If anyone has this lost mail problem (and has a Time Machine or other backup) and would like my stack please email me. The stack is rough for my own use at the moment but I can polish it for general use.