Prerequisites

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

1. Install

Get the Resend Python SDK.

2. Send email using HTML

The easiest way to send an email is by using the html parameter.

main.py
import resend
from typing import Dict
from fastapi import FastAPI

resend.api_key = "re_123456789"

app = FastAPI()

@app.post("/")
def send_mail() -> Dict:
    params: resend.Emails.SendParams = {
        "from": "onboarding@resend.dev",
        "to": ["delivered@resend.dev"],
        "subject": "Hello World",
        "html": "<strong>it works!</strong>",
    }
    email: resend.Email = resend.Emails.send(params)
    return email

3. Try it yourself

FastAPI Example

See the full source code.