Created
July 3, 2011 16:36
-
-
Save amcgregor/1062364 to your computer and use it in GitHub Desktop.
Utilizing marrow.mailer in your Pyramid application.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Marrow Mailer integration sample for Pyramid. | |
For information on Mailer, see: | |
https://github.com/marrow/marrow.mailer#readme | |
Delivery methods include: Google AppEngine, IMAP, log, maildir, mbox, sendmail, | |
Amazon Simple E-Mail Service, and SMTP. | |
""" | |
from pyramid.config import Configurator | |
from myproject.resources import Root | |
from marrow.mailer import Delivery | |
def main(global_config, **settings): | |
""" This function returns a Pyramid WSGI application.""" | |
config = Configurator(root_factory=Root, settings=settings) | |
# ... | |
config.registry['mailer'] = Delivery(config, 'mail') | |
return config.make_wsgi_app() | |
# In a view, later: | |
from marrow.mailer import Message | |
def my_view(request): | |
message = Message(...) | |
receipt = request.registry['mailer'].send(message) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment