Giter Site home page Giter Site logo

tornadomail's Introduction

Tornado mail

Asynchronous email sending(SMTP) library for Tornado. Port of django.mail.

Installation

Using pip: pip install tornadomail 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, '<your google mail>', '<your google password>',
            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'),
            '<your google mail>',
            [self.get_argument('email')],
            connection=self.mail_connection
        )
        message.send()#callback=_finish)
        self.render("index.html")

Requirements

The following two python libraries are required

Issues

Please report any issues via github issues

tornadomail's People

Contributors

anirbanroydas avatar ballagas avatar equeny avatar gizmondo avatar puentesarrin avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.