Metadata-Version: 2.4
Name: bmailer
Version: 0.1.1
Summary: Asynchronously send emails via SMTP
Author-email: duytanisme <duytanisme02@gmail.com>
Keywords: bmailer,smtp,async
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: License :: OSI Approved :: MIT License
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python
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 :: Only
Classifier: Topic :: Software Development :: Quality Assurance
Classifier: Topic :: Software Development :: Testing
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE-APACHE
Dynamic: license-file

# BMailer

[![image](https://img.shields.io/pypi/v/bmailer.svg)](https://pypi.python.org/pypi/bmailer)
[![image](https://img.shields.io/pypi/l/bmailer.svg)](https://pypi.python.org/pypi/bmailer)
[![image](https://img.shields.io/pypi/pyversions/bmailer.svg)](https://pypi.python.org/pypi/bmailer)
[![Actions status](https://github.com/duytanisme/bmailer/actions/workflows/test-and-release.yaml/badge.svg)](https://github.com/duytanisme/bmailer/actions)
[![codecov](https://codecov.io/gh/duytanisme/bmailer/branch/main/graph/badge.svg)](https://codecov.io/gh/duytanisme/bmailer)

BMailer is an asynchronous email sender built with Python, designed to send bulk emails efficiently using SMTP. It supports templating for email bodies and allows for concurrent sending of multiple emails.

## Example Usage

```python
import asyncio

from bmailer import AsyncMailer
from bmailer.models import EmailPayload
from bmailer.templates import render_template


async def main():
    sender = AsyncMailer(
        host="smtp.gmail.com",
        port=587,
        username="email@email.com",
        password="app_password", # If using Gmail, use an App Password
    )

    template = "Hello {name},\nYour order #{order_id} has been shipped."
    emails = [
        EmailPayload(
            subject="Order Update",
            recipient="target@email.com",
            body=render_template(template, name="Recipient", order_id=123),
        ),
    ]

    await sender.send_bulk(emails, concurrency=5)


if __name__ == "__main__":
    asyncio.run(main())
```

## Installation

```bash
pip install bmailer
```

## Contribution

Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.

```bash
git clone https://github.com/duytanisme/bmailer.git
cd bmailer
uv sync
```
