Ask HN: Best solution for local mail storage in a modern email client?
At first, something universally supported like mbox and to a lesser extent, maildir seems like the obvious answer, but these both seem to come with serious tradeoffs. Using mbox means putting all of your eggs in one basket (single file per mailbox), making it easy to corrupt, and neither is particularly friendly to advanced filtering and search functions. Both also get gradually less usable with every message stored, and maildir strikes me as unnecessarily I/O heavy. Both can be made searchable/filterable by keeping a separate, manually curated index, but that adds in another moving part to maintain and keep from breaking and is potentially a huge source of trouble.
One potential option would be to keep a local relational database (SQLite? Postgres?) with indexed metadata and references to individual messages on disk, with each message stored exactly as it would be as part of an mbox file, except all by itself. This should allow for fast searching/filtering (up to millions of messages) while also making it easy to export into standard mbox for use with other clients (just concat each message file into the resulting mbox file). Does this sound or am I completely off base? Is there a better option I should consider first?