Python SDK
The jetemail package is the official Python SDK for JetEmail transactional email (MIT license, Python 3.8+,requests 2.28+).
Create a transactional API key in the dashboard: Outbound → Keys → Add API key. Use that key with the SDK.
Installation
Quick start
from_ address on a verified domain (see Getting started).
The sender field is named
from_ (with a trailing underscore) because from is a reserved word in Python. It is sent to the API as from.Creating a client
requests). Passing an empty API key raises jetemail.ApiKeyIsMissing.
JetEmail(...) exposes two services:
client.emails.send(options)
Send a single email. options is a SendEmailOptions dataclass (import it from jetemail).
html nor text) raise a ValueError before any request is made.
Responses
Every call returns the API response as a plaindict. Response shape for a single send: {"id": str, "response": str}.
client.batch.send(emails)
Send up to 100 emails in one request. emails is a list of SendEmailOptions, each using the same fields as a single send. Returns a dict with summary (total, successful, failed) and results per message.
ValueError (the message includes the index of the offending email).
Attachments
Attachment holds a filename and base64-encoded data. Build one from a file path, from raw content, or directly:
Error handling
API and network errors raiseJetEmailError, which exposes message, status_code (0 for network failures) and response (the parsed error body, or None). Client-side validation raises a standard ValueError.
Webhook signature verification
The SDK includes a standalone helper for verifying webhook signatures that does not need a client instance. It checks the HMAC-SHA256 signature and rejects events whose timestamp is older than the tolerance (default 300 seconds).verify_webhook() returns True on success and raises WebhookSignatureVerificationFailed otherwise. Pass the raw request body as bytes; re-serialised JSON will not match the signature.
For additional examples, see the README on GitHub. REST details: API reference.