This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Tornado Email Queue is a non-blocking email queue for Python Tornado. This library uses MongoDB to store the queue data.

Installation

pip install emailqueue

Dependencies

Tornado Email Queue requires the environments officially supported by Tornado and MongoDB.

Requirements:

  • MongoDB
  • Python 2.7
  • tornado >= 4.2.1
  • motor >= 0.4.1
  • bson >= 0.4.0
  • futures >= 3.0.3

Examples

Here is a simple example of a Tornado web app with an email queue instance:

from tornado import httpserver, ioloop, web
from tornado.options import options
from emailqueue.queues import MongoDbEmailQueue

smtp_user = 'sender@gmail.com'
smtp_password = ''
recipient_addrs = 'recipient@hotmail.com'

# Create the email queue.
email_queue = MongoDbEmailQueue(
    smtp_host='smtp.gmail.com',
    smtp_port=587,
    smtp_user=smtp_user,
    smtp_password=smtp_password,
    mongodb_uri='mongodb://localhost:27017',
    mongodb_collection='email_queue',
    mongodb_database='sample_db',
    queue_maxsize=0
)


class MainHandler(web.RequestHandler):

    def get(self):

        # Put new email in the queue for processing
        # by the mailer worker at the scheduled time.
        email_queue.sendmail(
            subject='Hello World Sample',
            from_addr=smtp_user,
            to_addrs=recipient_addrs,
            text='Greetings from Tornado Email Queue.',
            mime_type='plain',
            charset='utf-8',
            scheduled_hours_from_now=0
        )

        # Render a tornado html template and put it in the queue
        # for processing by the mailer worker at the scheduled time.
        email_queue.sendmail_from_template(
            subject='Tornado Templates Sample',
            from_addr=smtp_user,
            to_addrs=recipient_addrs,
            template_path='templates/email.html',
            params={'link': 'http://ricardoyorky.github.io/emailqueue/'},
            mime_type='html',
            charset='utf-8',
            scheduled_hours_from_now=0
        )

        self.write("Mail sent")


def main():
    options.parse_command_line()
    application = web.Application([
        (r"/", MainHandler),
    ])

    # Add email queue callback to IOLoop
    ioloop.IOLoop.current().add_callback(email_queue.worker)

    http_server = httpserver.HTTPServer(application)
    http_server.listen(8888)
    ioloop.IOLoop.current().start()


if __name__ == "__main__":
    main()
Release History

Release History

0.1.3

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
emailqueue-0.1.3-py2-none-any.whl (10.8 kB) Copy SHA256 Checksum SHA256 py2 Wheel Aug 9, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting