I wrote my own email archiving software. The hardest part was dealing with all the weird edge cases in my 20+ year collection of .eml files. For being so simple conceptually, email is surprisingly complicated.
It never got too popular, but I had users for a few years and I can honestly say MIME was the bane of my life for most of those years.