tornadomail 0.1.2

Asynchronous email sending library for Tornado

  Add it to your Download Basket!

 Add it to your Watch List!

0/5

Rate it!
send us
an update
LICENSE TYPE:
The Apache License 2.0 
USER RATING:
UNRATED
  0.0/5
DEVELOPED BY:
Anton Agafonov
HOMEPAGE:
github.com
CATEGORY:
ROOT \ Communications \ Email
tornadomail provides asynchronous email sending library for Tornado. Port of django.mail.

Installation

From source: `git clone git://github.com/equeny/tornadomail.git; cd tornadomail; python setup.py install`

Usage

EmailMessage, EmailMultiAlternatives are almost identical to django classes, except send function is async and can receive callback argument.

    from tornadomail.message import EmailMessage, EmailMultiAlternatives
    from tornadomail.backends.smtp import EmailBackend


    class Application(tornado.web.Application):
        @property
        def mail_connection(self):
            return EmailBackend(
                'smtp.gmail.com', 587, '', '',
                True
            )

    class MainHandler(tornado.web.RequestHandler):

        @property
        def mail_connection(self):
            return self.application.mail_connection

        def get(self):
            self.render("index.html")

        def post(self):

            def _finish(num):
                print 'sended %d message(s)' % num
                self.render("index.html")

            message = EmailMessage(
                self.get_argument('subject'),
                self.get_argument('message'),
                '',
                [self.get_argument('email')],
                connection=self.mail_connection
            )
            message.send()#callback=_finish)
            self.render("index.html")

Last updated on March 15th, 2012

requirements

#asynchronous email #email sending #asynchronous #email #sending #library

Add your review!

SUBMIT