Metadata-Version: 2.4
Name: fastapi-mail
Version: 1.6.7
Summary: Simple lightweight mail library for FastApi
License: MIT
License-File: LICENSE
Author: Sabuhi Shukurov
Author-email: sabuhi.shukurov@gmail.com
Requires-Python: >=3.10
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Provides-Extra: httpx
Provides-Extra: redis
Requires-Dist: aiosmtplib (>=5.0.0)
Requires-Dist: blinker (>=1.9.0)
Requires-Dist: cryptography (>=50.0.0,<51.0.0)
Requires-Dist: email-validator (>=2.3.0)
Requires-Dist: httpx (>=0.28.1)
Requires-Dist: httpx ; extra == "httpx"
Requires-Dist: jinja2 (>=3.1.6)
Requires-Dist: pydantic (>=2.12.5)
Requires-Dist: pydantic-settings (>=2.6.1,<3.0.0)
Requires-Dist: redis (>=7.4.0,<8.0.0) ; extra == "redis"
Requires-Dist: regex (>=2025.11.3)
Requires-Dist: starlette (>=1.0.0,<2.0.0)
Requires-Dist: typing-extensions (>=4.15.0)
Description-Content-Type: text/markdown


# Fastapi-mail

Simple lightweight mail system for FastAPI — send emails, attachments, and HTML templates.

[![MIT licensed](https://img.shields.io/github/license/sabuhish/fastapi-mail)](https://raw.githubusercontent.com/sabuhish/fastapi-mail/master/LICENSE)
[![GitHub stars](https://img.shields.io/github/stars/sabuhish/fastapi-mail.svg)](https://github.com/sabuhish/fastapi-mail/stargazers)
[![GitHub issues](https://img.shields.io/github/issues-raw/sabuhish/fastapi-mail)](https://github.com/sabuhish/fastapi-mail/issues)
[![Downloads](https://pepy.tech/badge/fastapi-mail)](https://pepy.tech/project/fastapi-mail)


**Documentation**: [sabuhish.github.io/fastapi-mail](https://sabuhish.github.io/fastapi-mail/)

---

### Installation

```bash
pip install fastapi-mail
```

### Quick Start

```python
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](https://github.com/sabuhish/fastapi-mail/blob/master/CONTRIBUTING.md) before you start.

## Contributors

Thanks goes to these wonderful [people](https://github.com/sabuhish/fastapi-mail/graphs/contributors).

## LICENSE

[MIT](LICENSE)

