Skip to main content

Python client for the Mailenv API

Project description

mailenv

Transactional email for your app. This Python client lets you send transactional and promotional email through the Mailenv API so you can plug reliable, API-driven email straight into your SaaS, web app, or backend—password resets, welcome messages, notifications, and more. API docs.

Installation

pip install -e .

(Use your project’s normal install method if you have a pyproject.toml or setup.py.)

Basic usage

Set MAILENV_API_KEY in your environment to avoid passing the key in code, or pass api_key= to override.

from mailenv import Mailenv

client = Mailenv()  # uses MAILENV_API_KEY from env
# or: client = Mailenv(api_key="your-api-key")

result = client.send(
    to="user@example.com",
    sender="no-reply@yourdomain.com",
    subject="Hello",
    message="Hi there.",
)

# result["id"], result["status"]

Optional arguments include email_type (default "tx"), sender_name, campaign_id, mailing_list_id, user_id, customer_id, priority, headers, and extra_data. See the client docstrings for details.

Errors

On API or request failure the client raises MailenvError:

from mailenv import Mailenv, MailenvError

try:
    result = client.send(...)
except MailenvError as e:
    print(e.message, e.status_code, e.body)

Project details


Release history Release notifications | RSS feed

This version

1.0

Download files

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

Source Distribution

mailenv-1.0.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

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

mailenv-1.0-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file mailenv-1.0.tar.gz.

File metadata

  • Download URL: mailenv-1.0.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.11

File hashes

Hashes for mailenv-1.0.tar.gz
Algorithm Hash digest
SHA256 3f08e3f7bd5d5eec187908442089a7a6eae870212e8dae1fa6867e3cc130d26a
MD5 f2de40ed19abf7a35938418d1ca4f0a9
BLAKE2b-256 38795709e2fe36697b1dfd567bc00d54c1a337843e5126b6aad55ee77a3891f1

See more details on using hashes here.

File details

Details for the file mailenv-1.0-py3-none-any.whl.

File metadata

  • Download URL: mailenv-1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.11

File hashes

Hashes for mailenv-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1921f31ffab657c35b1238889fd9c2c480e6ee07800b8f347ee713ae3b68ea47
MD5 edb4f5754f982df29de34d753db77634
BLAKE2b-256 95c1a4d7cf1a9180eda004cd6d571106d222d765dd536e7c22c53b6c97ef9a38

See more details on using hashes here.

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