Giter Club home page Giter Club logo

pyramid_marrowmailer's Introduction

Pyramid integration package for "A highly efficient and modular mail delivery framework for Python 2.6+ and 3.1+, formerly TurboMail."

Currently it must be used with pyramid_tm, as .send() only works if transaction.commit() succeeded.

INSTALL

$ env/bin/easy_install pyramid_marrowmailer

USAGE

If you have package installed, you can configure it in Pyramid like always:

config.include('pyramid_marrowmailer')

All settings marrow.mailer expects are prefixed with mail.. If you want to use different prefix, set it with pyramid_marrowmailer.prefix.

To see what options marrow.mailer support, see the documentation. Note that boolean options need a .on suffix. For example mail.transport.debug.on = true. Options that need to be converted to integer, add int suffix. For example mail.transport.port.int = 1337.

pyramid_marrowmailer calls Mailer.start when config.include('pyramid_marrowmailer') is called. atexit is used to register Mailer.stop to shutdown when wsgi server will exit.

Note that pyramid_marrowmailer subclasses marrow.mailer.Mailer to provide support for transaction. Class is importable from pyramid_marrowmailer.TransactionMailer.

You can accces pyramid_marrowmailer.TransactionMailer instance in two ways:

message = request.mailer.new()
...
message.send()

Or:

from pyramid_marrowmailer import get_mailer
mailer = get_mailer(request)
message = mailer.new()
...
message.send()

EXAMPLE

If we have paster .ini something like:

mail.transport.use = smtp
mail.message.author = [email protected]

Inside a view, we can do:

message = request.mailer.new()
message.subject = "foobar2"
message.to = "[email protected]"
message.plain = "hi"
message.send()

TESTING

$ pip install nose coverage pep8 setuptools-flakes
$ ./pre-commit-check.sh

TODO

  • Add support to use marrow.mailer without usage of transaction

pyramid_marrowmailer's People

Contributors

domenkozar avatar silviot avatar

Watchers

James Cloos 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.