Metadata-Version: 2.4
Name: aiomailtm
Version: 0.1.0
Summary: A small async client for the mail.tm disposable email API.
Project-URL: Homepage, https://github.com/AkasakaID/aiomailtm
Project-URL: Repository, https://github.com/AkasakaID/aiomailtm
Author: AkasakaID
License: MIT
Keywords: async,disposable-email,httpx,mail.tm,temporary-email
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Communications :: Email
Requires-Python: >=3.8
Requires-Dist: httpx>=0.24
Requires-Dist: mnemonic>=0.20
Description-Content-Type: text/markdown

# aiomailtm

A small async Python client for the [mail.tm](https://mail.tm/) disposable email API.

## Installation

```bash
pip install aiomailtm
```

## Usage

```python
import asyncio
from aiomailtm import Aiomailtm


async def main():
    async with Aiomailtm() as client:
        account = await client.create_account()
        if not account.success:
            print(account.message)
            return

        print("Email:", account.email)
        print("Token:", account.token)

        message = await client.get_latest_email()
        if message.success:
            print("From:", message.from_address)
            print("Subject:", message.subject)
            print("Text:", message.text)
        else:
            print(message.message)


asyncio.run(main())
```

## API

### `Aiomailtm(password="Aiomailtm@123", proxy=None)`

Create a client. Pass an optional `proxy` URL and a custom `password`.

- `await create_account() -> AccountResult` — create a random account and authenticate the client.
- `await get_latest_email() -> MessageResult` — fetch the most recent email for the current account.
- `await get_domain() -> str | None` — return the first available mail.tm domain.
- `await close()` — close the underlying HTTP client (handled automatically with `async with`).

### `AccountResult`

| Field | Type | Description |
|-------|------|-------------|
| `success` | `bool` | Whether the operation succeeded |
| `message` | `str` | Human-readable status message |
| `email` | `str \| None` | The created email address |
| `token` | `str \| None` | The auth token |

### `MessageResult`

| Field | Type | Description |
|-------|------|-------------|
| `success` | `bool` | Whether an email was retrieved |
| `message` | `str` | Human-readable status message |
| `from_address` | `str \| None` | Sender address |
| `subject` | `str \| None` | Email subject |
| `text` | `str \| None` | Plain-text body |
| `html` | `str \| None` | HTML body |

## License

MIT
