https://github.com/xsleonard/flask-pystmark
Flask extension for Pystmark
https://github.com/xsleonard/flask-pystmark
email flask-extension postmark postmarkapp python
Last synced: about 1 year ago
JSON representation
Flask extension for Pystmark
- Host: GitHub
- URL: https://github.com/xsleonard/flask-pystmark
- Owner: xsleonard
- License: mit
- Created: 2013-10-09T22:18:52.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2019-09-26T10:03:29.000Z (almost 7 years ago)
- Last Synced: 2025-04-23T05:13:32.026Z (about 1 year ago)
- Topics: email, flask-extension, postmark, postmarkapp, python
- Language: Python
- Size: 43 KB
- Stars: 8
- Watchers: 1
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Flask-Pystmark
==============
[](http://badge.fury.io/py/Flask-Pystmark)
[](https://travis-ci.org/xsleonard/flask-pystmark)
[](https://coveralls.io/r/xsleonard/flask-pystmark)
Flask extension for [Pystmark](https://github.com/xsleonard/pystmark), a Postmark API library.
Flask-Pystmark supports Python 2.7, 3.6 and PyPy.
[Read the complete docs](https://flask-pystmark.readthedocs.org)
To run the tests, do `python setup.py test`
Example:
```python
# 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)
```