Skip to main content

Prerequisites

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

1. Install

Get the Resend Python SDK.
pip install resend

2. Send email using HTML

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

resend.api_key = os.environ["RESEND_API_KEY"]

app = Flask(__name__)


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

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


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

3. Try it yourself

Flask App

Full Flask web application

Basic Send

Basic email sending

Attachments

Send emails with file attachments

Templates

Send emails using Resend hosted templates

Scheduling

Schedule emails for future delivery

Audiences

Manage contacts and audiences

Domains

Create and manage sending domains

Inbound Webhooks

Receive and process inbound emails

Double Opt-in

Double opt-in subscription flow