fastapi-mail
Simple lightweight mail library for FastApi
Decision gist · record as of 2026-08-14
Yes. fastapi-mail is actively maintained, has low install friction, carries no known vulnerabilities, and is the standard choice for async email in FastAPI projects. The MIT license imposes no restrictions. Install it if you need to send email from a FastAPI application.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.10 or later.
- SMTP server credentials and network access to a mail server are required at runtime.
- Low friction install with a pure-Python wheel.
License · maintenance · safety
MIT (permissive) — MIT license is permissive; you can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.
last release 2026-06-18 (57 days)
0 known vulnerabilities (OSV.dev, 2026-08-14) · 1,426,701 downloads/mo, #3,914 on PyPI
Alternatives
Verify before relying
pip install fastapi-mail
from fastapi_mail import ConnectionConfig, FastMail, MessageSchema
from fastapi import FastAPI
conf = ConnectionConfig(
MAIL_USERNAME="user",
MAIL_PASSWORD="pass",
MAIL_FROM="sender@example.com",
MAIL_PORT=465,
MAIL_SERVER="smtp.example.com",
MAIL_SSL_TLS=True
)
app = FastAPI()
fm = FastMail(conf)
await fm.send_message(MessageSchema(subject="Test", recipients=["user@example.com"], body="Hello"))- Whether the package handles connection pooling or reuses SMTP connections efficiently under load.
- Performance characteristics when sending bulk emails (number of concurrent sends, rate limits).
- Whether Jinja2 template rendering is automatic or requires manual setup beyond what the fact sheet shows.
What it is and what it does
fastapi-mail is a lightweight async email library designed for FastAPI applications. It wraps aiosmtplib to send emails and attachments over SMTP, supporting both individual and bulk sends. The package integrates with FastAPI's background task system, allowing you to queue email sends without blocking request handling. It includes utilities for validating email addresses and supports Jinja2 HTML templates for message bodies, plus a NameEmail format that lets recipients be specified as "Name <email@domain.com>".
The library is built on standard async patterns (aiosmtplib, httpx, pydantic) and requires Python 3.10+. Configuration is handled via a ConnectionConfig object where you supply SMTP credentials, server details, and TLS settings. You create a FastMail instance, build a MessageSchema with subject, recipients, and body, then call send_message() to dispatch it asynchronously.
Use it for
- Send transactional emails (password resets, confirmations) from FastAPI endpoints without blocking the response.
- Queue bulk email campaigns using FastAPI background tasks to distribute sends over time.
- Render personalized HTML emails using Jinja2 templates with dynamic data from your application.
- Validate recipient email addresses before sending using the built-in email utility classes.
- Attach files from server storage or form uploads to outgoing messages.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
fastapi-mail is actively maintained, has low install friction, carries no known vulnerabilities, and is the standard choice for async email in FastAPI projects. The MIT license imposes no restrictions. Install it if you need to send email from a FastAPI application.
Install
fastapi-mail on PyPI
Before you install
Low friction install with a pure-Python wheel. Active maintenance with a release within the last 57 days. Depends on 11 runtime packages including cryptography and email-validator, all standard ecosystem choices.
Requires Python 3.10 or later. SMTP server credentials and network access to a mail server are required at runtime.
License in practice
MIT license is permissive; you can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.
Quickstart
pip install fastapi-mail
from fastapi_mail import ConnectionConfig, FastMail, MessageSchema
from fastapi import FastAPI
conf = ConnectionConfig(
MAIL_USERNAME="user",
MAIL_PASSWORD="pass",
MAIL_FROM="sender@example.com",
MAIL_PORT=465,
MAIL_SERVER="smtp.example.com",
MAIL_SSL_TLS=True
)
app = FastAPI()
fm = FastMail(conf)
await fm.send_message(MessageSchema(subject="Test", recipients=["user@example.com"], body="Hello"))
Verify before relying
- Whether the package handles connection pooling or reuses SMTP connections efficiently under load.
- Performance characteristics when sending bulk emails (number of concurrent sends, rate limits).
- Whether Jinja2 template rendering is automatic or requires manual setup beyond what the fact sheet shows.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 11 packagesaiosmtplibblinkercryptographyemail-validatorhttpxjinja2pydanticpydantic-settingsregexstarlettetyping-extensions |
| Maintenance | Actively maintained 57 days since the last release |
| First released | |
| Downloads | 1,426,701 / month, #3,914 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | License :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14 |
Evidence: fastapi_mail-1.6.5-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “fastapi email sending”
- fastapi-mailSends emails and attachments asynchronously from FastAPI applications…
- mailtrapOfficial Python client for Mailtrap's email sending and testing APIs,…
- resendResend Python SDK provides a client library for sending emails…
Give your agent the search over MCP, or paste the wish link into any chat.
More Dynamic Content packages
MarkupSafe provides a text object that escapes special characters so untrusted strings can be safely embedded in HTML and XML without injection attacks.
Jinja2 is a templating engine that renders dynamic content by combining templates with Python-like syntax and data, supporting template inheritance, macros, autoescaping, and sandboxed execution.
Soupsieve is a CSS selector library designed to work with Beautiful Soup 4 to select, match, and filter HTML and XML elements using modern CSS selectors from CSS level 1 through CSS level 4 specifications.
Install it if you use Beautiful Soup for HTML or XML parsing and want modern CSS selector support.
Werkzeug is a WSGI utility library providing request/response objects, URL routing, an interactive debugger, HTTP utilities, and a development server for building web applications.
Flask is a lightweight WSGI web application framework for building web applications in Python, from simple single-page sites to complex multi-route applications.
Mako compiles Python-embedded templates into Python modules for fast rendering, supporting layout inheritance, custom functions, and direct Python expressions within template syntax.
See also azure-communication-email · yagmail · django-post_office · fastapi-events · redmail · emails · aiosmtplib · resend · aioimaplib · codewords-client