Flask-Pystmark

A Flask extension for Postmark API library Pystmark


License
MIT
Install
pip install Flask-Pystmark==0.11.2

Documentation

Flask-Pystmark

PyPI version Build Status Coverage Status

Flask extension for Pystmark, a Postmark API library.

Flask-Pystmark supports Python 2.7, 3.6 and PyPy.

Read the complete docs

To run the tests, do python setup.py test

Example:

# app.py
from flask import Flask
from flask_pystmark import Pystmark, Message
from pystmark import ResponseError

app = Flask(__name__)
app.config['PYSTMARK_API_KEY'] = 'your_api_key'
app.config['PYSTMARK_DEFAULT_SENDER'] = 'admin@example.com'
pystmark = Pystmark(app)

@app.route('/')
def send():
    m = Message(to='user@gmail.com', text='Welcome')
    resp = pystmark.send(m)
    try:
        resp.raise_for_status()
    except ResponseError as e:
        return 'Failed to send message. Reason: {}'.format(e)
    else:
        return 'Sent message to {}'.format(resp.message.to)