Skip to main content

zasend

License: MIT Python

Official Python client for the zaSend transactional email API.

zaSend is a developer-focused email delivery service for sending product, auth, billing, notification, and lifecycle emails from your application. This package is a small wrapper around the zaSend REST API for Python apps, Django, Flask, FastAPI, background jobs, and scripts.

Use it to:

  • Send transactional email from verified domains
  • Send template-based email with variables
  • Check message status and events
  • Manage suppressions, webhooks, templates, and domains
  • Verify zaSend webhook signatures

The client stays close to the raw API. It has no heavy framework dependencies and uses requests.

Install

pip install zasend

Quick Start

from zasend import ZaSend

client = ZaSend(api_key="sk_live_...")

result = client.send_email(
    from_email="zaSend <noreply@zasend.com>",
    to="user@example.com",
    subject="Welcome",
    text="Thanks for signing up.",
)

print(result["message_id"])

You can use an Account API Key (sk_live_...) for all methods. A Domain Sending Key (dsk_live_...) is restricted to sending email from one verified domain.

Send HTML Email

client.send_email(
    from_email="Acme <noreply@acme.com>",
    to="customer@example.com",
    subject="Your receipt",
    html="<h1>Thanks for your order</h1><p>Your receipt is attached.</p>",
    text="Thanks for your order. Your receipt is attached.",
)

Send to Multiple Recipients

client.send_email(
    from_email="Acme <noreply@acme.com>",
    to=["one@example.com", "two@example.com"],
    subject="Product update",
    text="A new update is available.",
)

zaSend returns one queued message per to recipient. Suppressed recipients reject the whole request so you can fix the list before sending.

Template Send

client.send_template_email(
    from_email="Acme <noreply@acme.com>",
    to="customer@example.com",
    template="welcome",
    variables={"name": "Ada"},
)

Django Example

# settings.py
ZASEND_API_KEY = "sk_live_..."

# anywhere in your app
from django.conf import settings
from zasend import ZaSend

zasend = ZaSend(settings.ZASEND_API_KEY)
zasend.send_email(
    from_email="Acme <noreply@acme.com>",
    to=user.email,
    subject="Reset your password",
    text="Use this link to reset your password.",
)

Flask or FastAPI Example

import os
from zasend import ZaSend

zasend = ZaSend(os.environ["ZASEND_API_KEY"])

def send_signup_email(email):
    return zasend.send_template_email(
        from_email="Acme <noreply@acme.com>",
        to=email,
        template="welcome",
        variables={"product": "Acme"},
    )

Webhook Verification

zaSend signs webhook payloads with HMAC-SHA256. Verify the raw request body before trusting webhook data.

from zasend import verify_webhook_signature

ok = verify_webhook_signature(
    request.get_data(),
    "whsec_...",
    request.headers.get("X-zaSend-Signature"),
)

API Methods

Method Description
send_email(**message) Send direct content or a template email
send_template_email(...) Convenience wrapper for template sends
get_email(message_id) Fetch email status and events
get_rate_limits() Fetch daily usage and limits
list_domains() / add_domain(domain) / verify_domain(id) / delete_domain(id) Manage sending domains
list_suppressions(...) / add_suppression(email, ...) / delete_suppression(id) Manage suppression list entries
list_webhooks() / create_webhook(url, events) / delete_webhook(id) Manage signed delivery webhooks
list_templates() / create_template(...) / get_template(id) / update_template(id, ...) / delete_template(id) Manage email templates

Error Handling

from zasend import APIError, RateLimitError, ValidationError, ZaSend

try:
    ZaSend("sk_live_...").send_email(
        from_email="Acme <noreply@acme.com>",
        to="user@example.com",
        subject="Hello",
        text="Body",
    )
except RateLimitError as exc:
    print("Rate limited:", exc)
except ValidationError as exc:
    print("Invalid request:", exc)
except APIError as exc:
    print("zaSend API error:", exc)

License

MIT

Metadata

Release files for zasend 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for zasend 0.1.2
File Size Uploaded Provenance Actions
zasend-0.1.2.tar.gz 8.8 kB Without provenance Details for zasend-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for zasend 0.1.2
File Interpreter ABI Platform Actions
zasend-0.1.2-py3-none-any.whl Python 3 none any Details for zasend-0.1.2-py3-none-any.whl

Total release size: 14.8 kB

Release files / zasend-0.1.2.tar.gz

Download URL zasend-0.1.2.tar.gz
Size 8.8 kB
Tags Source
SHA-256 checksum
How to use checksums
baae447c60c7b57da1f563088ec98fa8fa1ef49f16c4cdd46c86d5d44bda7a7e
BLAKE2b-256 checksum
How to use checksums
10b67e3d8091bdde341c8835ef0ff8d8bad629eb5352802c163e93827ede703d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / zasend-0.1.2-py3-none-any.whl

Download URL zasend-0.1.2-py3-none-any.whl
Size 6.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8814fc0565433d5832fc60592f0de567816fb73dbb40b9ac4030a4e70c5c288e
BLAKE2b-256 checksum
How to use checksums
dd112edb58a42e8667a2ccd1e52f60a977c73afc67902fb933741b865a6f7dc1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Security for zasend 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page