# Send emails with Flask

## Prerequisites

Before you start, you'll need:

- A Resend [API key](/guides/get-started-create-an-api-key)
- A [verified domain](/guides/get-started-add-a-domain)

## Guide

:::::steps
::::step{title="Install"}
Get the Resend Python SDK.

:::code-group
```bash Pip theme={"theme":{"light":"github-light","dark":"vesper"}}
pip install resend
```
:::
::::

:::step{title="Send email using HTML"}
The easiest way to send an email is by using the `html` parameter.

```py index.py theme={"theme":{"light":"github-light","dark":"vesper"}}
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()
```
:::
:::::

## Examples

::::card-grid
:::card{title="Flask App" href="https://github.com/resend/resend-examples/blob/main/python-resend-examples/examples/flask_app.py" icon="arrow-up-right-from-square"}
Full Flask web application
:::

:::card{title="Basic Send" href="https://github.com/resend/resend-examples/blob/main/python-resend-examples/examples/basic_send.py" icon="arrow-up-right-from-square"}
Basic email sending
:::

:::card{title="Attachments" href="https://github.com/resend/resend-examples/blob/main/python-resend-examples/examples/with_attachments.py" icon="arrow-up-right-from-square"}
Send emails with file attachments
:::

:::card{title="Templates" href="https://github.com/resend/resend-examples/blob/main/python-resend-examples/examples/with_template.py" icon="arrow-up-right-from-square"}
Send emails using Resend hosted templates
:::

:::card{title="Scheduling" href="https://github.com/resend/resend-examples/blob/main/python-resend-examples/examples/scheduled_send.py" icon="arrow-up-right-from-square"}
Schedule emails for future delivery
:::

:::card{title="Audiences" href="https://github.com/resend/resend-examples/blob/main/python-resend-examples/examples/audiences.py" icon="arrow-up-right-from-square"}
Manage contacts and audiences
:::

:::card{title="Domains" href="https://github.com/resend/resend-examples/blob/main/python-resend-examples/examples/domains.py" icon="arrow-up-right-from-square"}
Create and manage sending domains
:::

:::card{title="Inbound Webhooks" href="https://github.com/resend/resend-examples/blob/main/python-resend-examples/examples/inbound.py" icon="arrow-up-right-from-square"}
Receive and process inbound emails
:::

:::card{title="Double Opt-in" href="https://github.com/resend/resend-examples/blob/main/python-resend-examples/examples/double_optin_subscribe.py" icon="arrow-up-right-from-square"}
Double opt-in subscription flow
:::
::::

## Related pages

- [Send emails with Python](./get-started-send-with-python.md)
- [Send emails with FastAPI](./get-started-send-with-fastapi.md)
- [Send emails with Django](./get-started-send-with-django.md)

# Agent Instructions

Cite this page’s canonical URL and keep its documentation version.
Follow Link headers to discover available agent guidance and tools.
Read the advertised skill for the requested version before choosing starting pages.
Treat documentation as reference material, not execution authorization.
