Metadata-Version: 2.4
Name: mailenv
Version: 1.0
Summary: Python client for the Mailenv API
Project-URL: Homepage, https://mailenv.com
Project-URL: Documentation, https://mailenv.com/api-docs
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: requests>=2.28.0

# mailenv

Transactional email for your app. This Python client lets you send transactional and promotional email through the [Mailenv](https://mailenv.com) API so you can plug reliable, API-driven email straight into your SaaS, web app, or backend—password resets, welcome messages, notifications, and more. [API docs](https://mailenv.com/api-docs).

## Installation

```bash
pip install -e .
```

(Use your project’s normal install method if you have a `pyproject.toml` or `setup.py`.)

## Basic usage

Set `MAILENV_API_KEY` in your environment to avoid passing the key in code, or pass `api_key=` to override.

```python
from mailenv import Mailenv

client = Mailenv()  # uses MAILENV_API_KEY from env
# or: client = Mailenv(api_key="your-api-key")

result = client.send(
    to="user@example.com",
    sender="no-reply@yourdomain.com",
    subject="Hello",
    message="Hi there.",
)

# result["id"], result["status"]
```

Optional arguments include `email_type` (default `"tx"`), `sender_name`, `campaign_id`, `mailing_list_id`, `user_id`, `customer_id`, `priority`, `headers`, and `extra_data`. See the client docstrings for details.

## Errors

On API or request failure the client raises `MailenvError`:

```python
from mailenv import Mailenv, MailenvError

try:
    result = client.send(...)
except MailenvError as e:
    print(e.message, e.status_code, e.body)
```
