Skip to content

Stranger6667/Flask-Postmark

Repository files navigation

Flask Postmark

Build Coverage Version Python versions Documentation Status License

This is a simple integration with Postmark for Flask applications.

Installation

Installing is simple with pip:

$ pip install flask-postmark

Usage

To send an email in your Flask application:

from flask import Flask
from flask_postmark import Postmark

app = Flask(__name__)
app.config["POSTMARK_SERVER_TOKEN"] = "<replace with your server token>"

postmark = Postmark(app)


@app.route("/send", methods=["POST"])
def send():
    postmark.send(
        From="sender@example.com",
        To="receiver@example.com",
        Subject="Postmark test",
        HtmlBody="<html><body><strong>Hello</strong> dear Postmark user.</body></html>",
    )
    return b"OK"

Documentation

You can view the documentation online at:

Or you can look at the docs/ directory in the repository.