I think the biggest service here is
1. Education about Python's pretty decent standard smtpd lib.
2. Food for thought about making thin custom interfaces over standard libraries.
3. Perhaps inspiration to do more?
It's no Linux kernel, but I enjoyed reading through the source and I feel like I have a better understanding of Python's smtpd lib and I've some of my own ideas for future API design.
Additionally, I like your generator-based API proposal. Also inspiring. Need to think more about routing in that context, though.
SMTP does have many edge cases, and if you're interested in handling all of them, you should use a more robust server. I am not.
> "One instance should handle over one thousand emails per second, thanks to Gevent."
Take a look at the code, it's very small.
Want your app to send some mail? Please please please don't try delivering directly. The only people great at this are spammers. Use a real MTA and the mail() function that is built into basically every language.
I hope no one uses this in production. Handling SMTP well is all about the edge cases, and this doesn't seem to handle any of them.
This is just a thin wrapper on python stdlib smtpd.SMTPServer, which is itself not production ready. It also doesn't really make it easier. The original API is better. Why are magic decorators better than inheritance again?
Also, monkey patching? Hidden side effects make sad pandas cry. Let me throw up a little in my mouth.
There are zero unit tests for this, and no functional tests.
The original API has better documentation. What are the to, sender, and body arguments?
Below seems a simpler API, and gives you the subject too. I thought humans would be interested in the subject... but I guess not.