Skip to main content

JetEmail Python SDK for transactional email sending

Project description

JetEmail Python SDK

The official Python SDK for JetEmail transactional email.

Installation

pip install jetemail

Quick Start

from jetemail import JetEmail, SendEmailOptions

client = JetEmail(api_key="your_api_key")

result = client.emails.send(
    SendEmailOptions(
        from_="you@yourdomain.com",
        to="recipient@example.com",
        subject="Hello from JetEmail",
        html="<p>Welcome!</p>",
    )
)

print(result["id"])

Send an Email

from jetemail import JetEmail, SendEmailOptions, Attachment

client = JetEmail(api_key="your_api_key")

client.emails.send(
    SendEmailOptions(
        from_="You <you@yourdomain.com>",
        to=["alice@example.com", "bob@example.com"],
        subject="Monthly Report",
        html="<h1>Report</h1><p>See attached.</p>",
        text="Report - see attached.",
        cc="manager@example.com",
        bcc="archive@example.com",
        reply_to="support@yourdomain.com",
        headers={"X-Entity-Ref-ID": "report-2025-01"},
        attachments=[
            Attachment.from_path("/path/to/report.pdf"),
            Attachment.from_content("raw,csv,data", "data.csv"),
        ],
    )
)

Send Batch Emails

Send up to 100 emails in a single API call:

from jetemail import JetEmail, SendEmailOptions

client = JetEmail(api_key="your_api_key")

emails = [
    SendEmailOptions(
        from_="you@yourdomain.com",
        to=recipient,
        subject="Hello!",
        html=f"<p>Hi {name}!</p>",
    )
    for name, recipient in [("Alice", "alice@example.com"), ("Bob", "bob@example.com")]
]

result = client.batch.send(emails)
print(result["summary"])

Webhook Verification

Verify incoming webhook signatures without a client instance:

from jetemail import verify_webhook
from jetemail.webhook_verification import WebhookSignatureVerificationFailed

try:
    verify_webhook(
        payload=request.body,             # raw bytes
        signature=request.headers["X-Webhook-Signature"],
        timestamp=request.headers["X-Webhook-Timestamp"],
        secret="your_webhook_secret",
        tolerance=300,                    # seconds (default)
    )
    # Signature is valid
except WebhookSignatureVerificationFailed as e:
    # Signature invalid or timestamp expired
    print(e)

Error Handling

from jetemail import JetEmail, SendEmailOptions, JetEmailError

client = JetEmail(api_key="your_api_key")

try:
    client.emails.send(
        SendEmailOptions(
            from_="you@yourdomain.com",
            to="recipient@example.com",
            subject="Test",
            html="<p>Hi</p>",
        )
    )
except JetEmailError as e:
    print(f"Status: {e.status_code}")
    print(f"Message: {e.message}")
    print(f"Response: {e.response}")

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jetemail-0.1.0.tar.gz (9.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jetemail-0.1.0-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file jetemail-0.1.0.tar.gz.

File metadata

  • Download URL: jetemail-0.1.0.tar.gz
  • Upload date:
  • Size: 9.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for jetemail-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7a1d18cc47ea60d4a8550033b2c7144d564785d082f7aef3b1b098ee18ca472e
MD5 29c7c37b6c3df3f9efa18025720471a5
BLAKE2b-256 16a8efbe23c87efb07215d29a15386eac924743e2a4d9ae6bad2671e737de198

See more details on using hashes here.

Provenance

The following attestation bundles were made for jetemail-0.1.0.tar.gz:

Publisher: publish.yml on jetemail/jetemail-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file jetemail-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: jetemail-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for jetemail-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 89b77d4bc806dfca27fd997bbb6a363056f83d06d3d8f7cb8f70fdc80d3b6871
MD5 ac9eaed84e03dda24d6bdd4583a7c21c
BLAKE2b-256 f2c5384dc529d1cb30ad3e1a3a56bbc07941f168a205751c05e41d89504cd30e

See more details on using hashes here.

Provenance

The following attestation bundles were made for jetemail-0.1.0-py3-none-any.whl:

Publisher: publish.yml on jetemail/jetemail-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page