Metadata-Version: 2.4
Name: mailbot-sdk
Version: 0.1.0b1
Summary: Python SDK for mailbot, developer-first programmable email infrastructure by Mailtarget
Author-email: Yopie Suryadi <yopie.suryadi@gmail.com>
License: MIT
Project-URL: Homepage, https://agentmail.omyop.com/docs
Project-URL: Repository, https://github.com/yopiesuryadi/mailtarget_agent
Keywords: mailtarget,email,sdk,agents,api
Classifier: Development Status :: 4 - Beta
Classifier: Framework :: AsyncIO
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: httpx>=0.27.0
Provides-Extra: test
Requires-Dist: pytest>=7.0; extra == "test"
Requires-Dist: pytest-asyncio>=0.21; extra == "test"

# mailbot

Python SDK source for the mailbot API.

Default API base: `https://agentmail.omyop.com/v1`

Current status: code is in the repository, but public package publishing is still pending.

## Sync quick start

```python
from mailbot import MailBot

client = MailBot(api_key="mb_xxx")
inbox = client.inboxes.create(username="support-bot")
```

## Domain onboarding

```python
domain = client.domains.create(domain="myapp.com")
print(domain["dns_records"])

verified = client.domains.verify(domain["id"])
print(verified["status"])
```

## Async quick start

```python
import asyncio
from mailbot import MailBot

async def main():
    async with MailBot(api_key="mb_xxx") as client:
        await client.http.arequest("GET", "/usage")

asyncio.run(main())
```

## Webhook handling

```python
import hmac
import hashlib

def verify_webhook(body: bytes, signature: str, secret: str) -> bool:
    expected = hmac.new(secret.encode(), body, hashlib.sha256).hexdigest()
    return hmac.compare_digest(expected, signature)
```

## Compliance checking

```python
client.compliance.check(domain="example.com")
client.compliance.readiness(inbox_id="inbox_123")
```

## CI/email testing

```python
result = client.messages.wait_for(
    "inbox_123",
    direction="inbound",
    subject_contains="Verify your account",
    timeout_ms=20000,
)

print(result["data"]["subject"])
```

## Error handling

```python
from mailbot import MailBot, AuthError, RateLimitError

client = MailBot(api_key="mb_xxx")

try:
    client.inboxes.list()
except AuthError:
    print("Invalid API key")
except RateLimitError:
    print("Too many requests")
```
