Python
There’s no official 3AVA Mail Python client — but the API is wire-compatible with Resend’s, so the official resend PyPI package works out of the box. Or use requests / httpx directly.
Option 1: Resend SDK (drop-in)
Section titled “Option 1: Resend SDK (drop-in)”pip install resendimport resend
resend.api_key = "am_YOUR_KEY"resend.api_url = "https://mail.3ava.com/api"
resend.Emails.send({ "subject": "Hello", "html": "<p>Hi.</p>",})Option 2: requests (zero dependencies)
Section titled “Option 2: requests (zero dependencies)”import requests
API_KEY = "am_YOUR_KEY"BASE = "https://mail.3ava.com/api"
def send_email(**fields): r = requests.post( f"{BASE}/emails", headers={"Authorization": f"Bearer {API_KEY}"}, json=fields, timeout=30, ) r.raise_for_status() return r.json()
result = send_email( subject="Hello", html="<p>Hi.</p>",)print(result["id"])Option 3: httpx (async)
Section titled “Option 3: httpx (async)”import httpx
async def send_email(**fields): async with httpx.AsyncClient(timeout=30) as client: r = await client.post( "https://mail.3ava.com/api/emails", headers={"Authorization": "Bearer am_YOUR_KEY"}, json=fields, ) r.raise_for_status() return r.json()Idempotency
Section titled “Idempotency”import uuid
requests.post( f"{BASE}/emails", headers={ "Authorization": f"Bearer {API_KEY}", "Idempotency-Key": f"order-{order_id}-receipt", }, json={...},)Attachments
Section titled “Attachments”import base64
with open("invoice.pdf", "rb") as f: encoded = base64.b64encode(f.read()).decode()
send_email( subject="Invoice", html="<p>Attached.</p>", attachments=[{ "filename": "invoice.pdf", "content": encoded, "content_type": "application/pdf", }],)