Fastapi-mail
Simple lightweight mail system for FastAPI — send emails, attachments, and HTML templates.
Documentation: sabuhish.github.io/fastapi-mail
Installation
pip install fastapi-mail
Quick Start
from typing import List
from fastapi import FastAPI
from fastapi_mail import ConnectionConfig, FastMail, MessageSchema, MessageType, NameEmail
from pydantic import BaseModel
from starlette.responses import JSONResponse
class EmailSchema(BaseModel):
email: List[NameEmail]
conf = ConnectionConfig(
MAIL_USERNAME="username",
MAIL_PASSWORD="**********",
MAIL_FROM="test@email.com",
MAIL_PORT=465,
MAIL_SERVER="mail server",
MAIL_STARTTLS=False,
MAIL_SSL_TLS=True,
USE_CREDENTIALS=True,
VALIDATE_CERTS=True,
)
app = FastAPI()
@app.post("/email")
async def simple_send(email: EmailSchema) -> JSONResponse:
message = MessageSchema(
subject="Fastapi-Mail module",
recipients=email.model_dump().get("email"),
body="<p>Thanks for using Fastapi-mail</p>",
subtype=MessageType.html,
)
await FastMail(conf).send_message(message)
return JSONResponse(status_code=200, content={"message": "email has been sent"})
Contributing
Contributions of any kind are welcome! Please read CONTRIBUTING before you start.
Contributors
Thanks goes to these wonderful people.
LICENSE
Metadata
Release files for fastapi-mail 1.6.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| fastapi_mail-1.6.8.tar.gz | 13.8 kB | Without provenance | Details for fastapi_mail-1.6.8.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fastapi_mail-1.6.8-py3-none-any.whl | Python 3 | none | any | Details for fastapi_mail-1.6.8-py3-none-any.whl |
Total release size: 30.0 kB
Release files / fastapi_mail-1.6.8.tar.gz
| Download URL | fastapi_mail-1.6.8.tar.gz |
|---|---|
| Size | 13.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ba8a6e85ed494b7b578ddc9247592df9fd9006b6bc80ad29851d0820c9434270
|
|
BLAKE2b-256 checksum How to use checksums |
203689d9c39a12692ac0dfdf4913d05d3944febb67c0d0285e04e506645c7e8b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.4.1 CPython/3.11.16 Linux/6.17.0-1022-azure
|
Release files / fastapi_mail-1.6.8-py3-none-any.whl
| Download URL | fastapi_mail-1.6.8-py3-none-any.whl |
|---|---|
| Size | 16.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b3b354770572e476a2bc6b482539855cdacb351d33bde44fc4c7057507ba3845
|
|
BLAKE2b-256 checksum How to use checksums |
fd7f659ef0ebb06112def6a17370ece99c37feaed8428c71a20645325338588e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.4.1 CPython/3.11.16 Linux/6.17.0-1022-azure
|
Security for fastapi-mail 1.6.8
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.