I am reminded a little of the Postgres-backed IMAP server Archiveopteryx: https://github.com/aox/aox
The schema from AOX always looked really good to me, but I never have gotten to really giving it a try. I wanted to use it, primarily, to get analytics about my mail and for search (not a daily-driver IMAP server).