OpenSMTPD and a small Go program I wrote: https://github.com/forlater-email/mdawh. Reads mail from stdin and sends a webhook to the mail processing/sending service.
Asking because I'm also about to embark on an email-related product in a similar spirit to yours.
But yeah, I'd really like to switch to running my own mail server and not have to use Mailgun. Maybe later this year.