Overview
FastAPI-Mail 1.0, released on September 1, 2021, is the first stable release for async email sending with FastAPI.
Main Features
Async email sending
Async API for sending emails with Jinja2 template support, attachments, and configurable SMTP connections.
python
from fastapi_mail import FastMail, MessageSchema, ConnectionConfig
conf = ConnectionConfig(
MAIL_USERNAME='user@example.com',
MAIL_PASSWORD='password',
MAIL_FROM='user@example.com',
MAIL_SERVER='smtp.example.com',
MAIL_PORT=587,
MAIL_STARTTLS=True,
MAIL_SSL_TLS=False,
)
message = MessageSchema(
subject='Test',
recipients=['dest@example.com'],
body='Hello!',
subtype='plain',
)
fm = FastMail(conf)
# await fm.send_message(message)
