Skip to main content

Prerequisites

To get the most out of this guide, you’ll need to:

1. Install

Get the Emailr Python SDK.
pip install emailr

2. Send email using HTML

The easiest way to send an email is by using the html parameter.
index.py
import emailr
import os
from flask import Flask, jsonify

emailr.api_key = os.environ["EMAILR_API_KEY"]

app = Flask(__name__)


@app.route("/")
def index():
    params: emailr.Emails.SendParams = {
        "from": "Acme <[email protected]>",
        "to": ["[email protected]"],
        "subject": "hello world",
        "html": "<strong>it works!</strong>",
    }

    r = emailr.Emails.send(params)
    return jsonify(r)


if __name__ == "__main__":
    app.run()

3. Try it yourself

Flask Example

See the full source code.