I wrote a transactional mail system that output both HTML and plain text mail in 2001.
A log time ago I brote a bot to count bounced email in VB6. I knew the difference between HELO and EHLO. I not longer remember. Last time I had to write something similar, I just used a few libraries in Racket.