July 2026
Python SDK
A typed, sync and async Python client for sending mail, scheduling sends, and verifying webhooks. Built for Python 3.12+.
Python SDK
What it does
mailkube is the official Python client library. Install it with pip install mailkube or uv add mailkube, set an API key, and send your first message in a few lines. It ships fully typed, requires Python 3.12+, and is Apache-2.0 licensed.
Key benefits
- Sync or async, same client shape.
MailkubeandAsyncMailkubeshare an identical method surface, so moving a codebase from sync to async is a client swap, not a rewrite. - Scheduled sends built in. Pass
scheduled_atonemails.send, then manage the queue withclient.scheduled_emails, including batch reschedule and cancel through a sharedbatch_id. - Webhook verification with no framework glue.
mailkube.verify(raw_body, headers, signing_secret)is a pure stdlib helper that works the same whether the receiver is Flask, FastAPI, or something custom. - Safe to retry. An
idempotency_keyon every send means a retried request after a timeout can’t double-send, and a typed error hierarchy makes failures easy to branch on.
Getting started
- Install the SDK:
pip install mailkube - Set your API key as
MAILKUBE_API_KEY, or passapi_key=to the client - Send a first message:
from mailkube import Mailkube
with Mailkube() as client:
email = client.emails.send(
from_="Acme <hello@yourdomain.com>",
to="customer@example.com",
subject="Hello world",
html="<p>It works!</p>",
)
print("sent:", email.id)
- Verify an inbound webhook with
mailkube.verify(...) - Read the Python SDK docs for templates, attachments, tags, and the full error reference