Metadata-Version: 2.4
Name: codemail-sdk
Version: 0.1.0
Summary: SDK Python da Codemail: envio de e-mail transacional por API.
Author-email: Codemail <suporte@codemail.com.br>
License: MIT
Project-URL: Homepage, https://codemail.com.br
Project-URL: Repository, https://github.com/codemail/codemail-python
Project-URL: Issues, https://github.com/codemail/codemail-python/issues
Keywords: email,transactional,smtp,api,codemail
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.9
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: Topic :: Communications :: Email
Classifier: Typing :: Typed
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# Codemail para Python

```bash
pip install codemail-sdk
```

```python
from codemail import Codemail, Attachment

cm = Codemail("cm_live_...")            # ou defina CODEMAIL_API_KEY

r = cm.emails.send(
    from_="alerta@meudominio.com.br",   # precisa ser do domínio da chave
    to="ana@cliente.com",               # um endereço ou uma lista
    subject="Seu pedido foi enviado",
    html="<p>Olá!</p>",
    attachments=[Attachment.from_file("nota.pdf")],
)
print(r.id, r.status)                    # status: queued (o envio é assíncrono)

cm.emails.get(r.id).status               # queued, sent, delivered, bounced...
cm.emails.events(r.id)                   # linha do tempo
cm.emails.list(status="bounced", limit=20)
```

- **Idempotente por padrão:** cada `send` leva um `Idempotency-Key` e o repete nas retentativas, então um timeout
  nunca vira dois e-mails. Passe `idempotency_key="..."` para controlar você mesmo.
- **Retentativas:** erro de rede, 429 (respeita `Retry-After`) e 5xx, até `max_retries` (padrão 2).
- **Erros tipados:** `AuthenticationError`, `PermissionDeniedError`, `NotFoundError`, `InvalidRequestError`
  (`param` diz o campo), `RateLimitError` (`retry_after`), `ServerError`, `APIConnectionError`.
- Sem dependências. Python 3.9+.
