Skip to content

xsleonard/flask-pystmark

master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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)