Mailtea Python SDK — send, schedule, and manage email from your app or AI agent.
Project description
mailtea (Python)
The official Python SDK for Mailtea — a thin, zero-dependency wrapper over the REST API. Python 3.9+.
Install
pip install mailtea
Usage
import os
from mailtea import Mailtea
mailtea = Mailtea(os.environ["MAILTEA_API_KEY"])
sent = mailtea.emails.send(
from_="you@yourdomain.com",
to="recipient@example.com",
subject="Hello from Mailtea",
html="<p>Your first email, sent with <strong>Mailtea</strong>.</p>",
)
print(sent.id)
email = mailtea.emails.get(sent.id)
print(email.status)
The API key can be passed to Mailtea(api_key) or read from MAILTEA_API_KEY.
Self-hosting or local dev? pass base_url= or set MAILTEA_API_BASE_URL.
Every method equally accepts a single wire-format dict — handy when you already hold the JSON payload:
sent = mailtea.emails.send({
"from": "you@yourdomain.com",
"to": "recipient@example.com",
"subject": "Hello from Mailtea",
"html": "<p>Your first email, sent with <strong>Mailtea</strong>.</p>",
})
print(sent["id"]) # responses support ["..."] and attribute access alike
Keyword arguments use snake_case wire names; a trailing underscore escapes
Python reserved words (from_= → "from").
API
| Method | Description |
|---|---|
emails.send(params) |
Send a transactional email → {"id": ...} |
emails.batch(emails) |
Send up to 100 emails → {"data": [{"id": ...}]} |
emails.get(id) |
Retrieve an email and its delivery status |
emails.list(params=None) |
List emails → {"data", "total", "limit", "offset", "has_more"} |
emails.update(id, params) |
Reschedule a scheduled email |
emails.reschedule(id, scheduled_at) |
Convenience wrapper over update |
emails.cancel(id) |
Cancel a scheduled email |
contacts.create / upsert / list / get / update / delete |
Manage audience contacts (upsert = create; the endpoint upserts) |
posts.create(...) |
Create a newsletter post (draft, or send=True) → {"id": ...} |
posts.send(id, scheduled_at=None) |
Send a draft post to the audience, now or scheduled |
posts.send_test(id, params) |
Send a [TEST] copy of a post → {"sent_to", "failed_to"} |
segments.create / list / get / update / delete |
Manage audience segments |
tags.create / list / get / update / delete |
Manage tag definitions |
domains.create / list / get / verify / update / delete |
Manage sending domains (add, read DNS records, verify) |
domains.tracking.create / list / verify / delete |
Manage CNAME tracking sub-domains under a domain |
webhooks.create / list / get / update / delete |
Manage outbound event subscriptions |
contact_properties.create / list / update / delete |
Manage custom contact fields (team-scoped) |
api_keys.create / list / revoke |
Manage API keys (settings:write) |
Payloads follow the REST wire format (reply_to, scheduled_at, …), passed as
keyword arguments or a plain dict. Errors raise MailteaError with status,
details, and request_id.
Develop
cd sdks/python
python3 -m unittest discover -s tests -t .
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mailtea-0.1.2.tar.gz.
File metadata
- Download URL: mailtea-0.1.2.tar.gz
- Upload date:
- Size: 12.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9b42edcee331eae819777ddfd9e83143dabf1a9ee779e513a792849cec793574
|
|
| MD5 |
ae30a67f2e73ff0dcb21d9a6b4dede1a
|
|
| BLAKE2b-256 |
71bb5694209c6a0adfc6909f1a282a2a9e2a53ff7371ea599a8636bb07943d99
|
Provenance
The following attestation bundles were made for mailtea-0.1.2.tar.gz:
Publisher:
publish-pypi.yml on mailtea-app/mailtea
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mailtea-0.1.2.tar.gz -
Subject digest:
9b42edcee331eae819777ddfd9e83143dabf1a9ee779e513a792849cec793574 - Sigstore transparency entry: 2165608270
- Sigstore integration time:
-
Permalink:
mailtea-app/mailtea@6535cd0a794645564dbd1b222ad291a8fdcefa47 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/mailtea-app
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@6535cd0a794645564dbd1b222ad291a8fdcefa47 -
Trigger Event:
push
-
Statement type:
File details
Details for the file mailtea-0.1.2-py3-none-any.whl.
File metadata
- Download URL: mailtea-0.1.2-py3-none-any.whl
- Upload date:
- Size: 15.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
330971f11e3829036276f5b7427ec34972e895d90de3e836e932d06ec79fd0f2
|
|
| MD5 |
62fc4f810b67e4d4b885553ef00b994e
|
|
| BLAKE2b-256 |
e106d0316d9a639abf00875fd24ff047daefcf283e15fe931e0ac10186426794
|
Provenance
The following attestation bundles were made for mailtea-0.1.2-py3-none-any.whl:
Publisher:
publish-pypi.yml on mailtea-app/mailtea
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mailtea-0.1.2-py3-none-any.whl -
Subject digest:
330971f11e3829036276f5b7427ec34972e895d90de3e836e932d06ec79fd0f2 - Sigstore transparency entry: 2165608277
- Sigstore integration time:
-
Permalink:
mailtea-app/mailtea@6535cd0a794645564dbd1b222ad291a8fdcefa47 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/mailtea-app
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@6535cd0a794645564dbd1b222ad291a8fdcefa47 -
Trigger Event:
push
-
Statement type: