For the complete documentation index, see llms-docs.txt or the site index llms.txt. Full docs corpus: llms-full-docs.txt. Prefer the markdown version of this page at /docs/examples/python/fastapi.md. Product capabilities: skill.md. Docs MCP: /docs/mcp. Site MCP: /mcp.
Send Email with FastAPI
Send transactional email from FastAPI with the Reloop Python SDK. Includes env setup and a complete async send-mail endpoint example.
Installation
Install the official Python SDK:
pip install reloop-email
Setup Environment Variables
Add your API key to your environment:
export RELOOP_API_KEY="re_your_api_key_here"
Sending an Email
Here is a simple FastAPI route that sends an email:
import os
from fastapi import FastAPI, HTTPException
from reloop_email import Reloop
app = FastAPI()
reloop = Reloop(api_key=os.environ.get("RELOOP_API_KEY"))
@app.post("/send-email")
async def send_email():
try:
result = reloop.mail.send({
"from": "onboarding@reloop.sh",
"to": "delivered@resend.dev",
"subject": "Hello from FastAPI",
"html": "<p>Congrats on sending your first email via Reloop from FastAPI!</p>",
})
if result.email_error:
raise result.email_error
return result.response
except Exception as e:
raise HTTPException(status_code=500, detail=str(e))Was this page helpful?