Skip to main content
Resend Docs

Search documentation

Type to search this documentation.

On this pageOverview

Send emails with Flask

Before you start, you'll need:

  1. Install

    Get the Resend Python SDK.

    Pip
    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()
Suggest an edit

Propose a replacement for this page. The site team reviews it before applying any changes.

Export
Documentation menu