Skip to main content

Documentation Index

Fetch the complete documentation index at: https://jetemail.com/docs/llms.txt

Use this file to discover all available pages before exploring further.

Python SDK

The jetemail package is the official Python SDK for JetEmail transactional email (MIT license, Python 3.8+). Create a transactional API key in the dashboard: OutboundKeys → Add API key. Use that key with the SDK.

Installation

pip install jetemail
Package on PyPI: jetemail.

Quick start

from jetemail import JetEmail

client = JetEmail("your-transactional-api-key")

result = client.email.send(
    from_address="Your App <hello@yourdomain.com>",
    to="user@example.com",
    subject="Welcome!",
    html="<h1>Welcome!</h1>"
)
Use a from_address on a verified domain (see Getting started).

Constructor

# API key string
client = JetEmail("your-transactional-api-key")

# Or with options
client = JetEmail(
    api_key="your-transactional-api-key",
    base_url="https://api.jetemail.com"  # optional
)

client.email.send(**options)

Send a single email.
FieldRequiredDescription
from_addressSender, e.g. "Name <email@domain.com>"
toRecipient(s), string or list (max 50)
subjectSubject line
html*HTML body (need html and/or text)
text*Plain text (need html and/or text)
cc, bcc, reply_toRecipients (max 50 each)
headersCustom headers dict
attachmentsAttachments (max 40MB total)
Response shape: { "id": str, "response": str }.

client.batch.send(emails)

Send up to 100 emails in one request. Returns summary (total, successful, failed) and results per message.
result = client.batch.send([
    {
        "from_address": "you@example.com",
        "to": "alice@example.com",
        "subject": "Hello Alice",
        "html": "<p>Hi Alice!</p>",
    },
    {
        "from_address": "you@example.com",
        "to": "bob@example.com",
        "subject": "Hello Bob",
        "html": "<p>Hi Bob!</p>",
    },
])

Attachments

from jetemail import Attachment

result = client.email.send(
    from_address="you@example.com",
    to="recipient@example.com",
    subject="Invoice",
    html="<p>Please find your invoice attached.</p>",
    attachments=[
        Attachment.from_path("/path/to/invoice.pdf"),
        Attachment.from_content("Hello World", "hello.txt"),
    ],
)

Error handling

from jetemail import JetEmail, JetEmailError

try:
    client.email.send(...)
except JetEmailError as e:
    print(e.status_code, e.message, e.response)
Common status codes: 400 invalid request, 401 bad/missing API key, 500 server error.
For additional examples and the full option list, see the PyPI package page. REST details: API reference.