I'am looking for python async SMTP client to connect it with Torando IoLoop. I found only simple implmementation (http://tornadogists.org/907491/) but it's a blocking solution so it might bring performance issues.
Does anyone encountered non blocking SMTP client for Tornado? Some code snippet would be also very useful.
I'm not using my own SMTP server but figured this would be useful to someone:
I've just had to add email sending to my app. Most of the sample python code for the web emailing services use a blocking design so I dont want to use it.
Mailchimp's Mandrill uses HTTP POST requests so it can work in an Async fashion fitting in with Tornado's design.
https://github.com/equeny/tornadomail - here is my attemp to port django mail system and python smtplib to tornado ioloop. Will be happy to hear some feedback.
I was looking for the solution to the same problem at work. Since there was no readily available solution, I ported Python smtplib to implementation based on tornado non-blocking IOStream. The syntax follows that of smtplib as close as possible.
It currently only supports Python 3.3 and above. Here's the github repo
I wrote solution based on threads and queue. One thread per tornado process. This thread is a worker, gets email from queue and then send it via SMTP. You send emails from tornado application by adding it to queue. Simple and easy.
Here is sample code on GitHub: link
Just FYI - I just whipped up a ioloop based smtp client. While I can't say it's production tested, it will be in the near future.
https://gist.github.com/1358253