Skip to main content

Features

Python SDK

A typed, sync and async Python client for sending transactional email, scheduling sends, and verifying webhooks.

Sync or async, one client

The mailkube Python SDK is fully typed and gives you Mailkube for synchronous code and AsyncMailkube for async, with the same method surface either way. Install it and send your first message in a few lines.

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)

What the SDK gives you

  • Sync or async, same client shape. Mailkube and AsyncMailkube share 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_at on emails.send, then manage the queue with client.scheduled_emails, including batch reschedule and cancel through a shared batch_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_key on every send means a retried request after a timeout can’t double-send, and a typed error hierarchy makes failures easy to branch on.

What’s next