Skip to main content

Official Python SDK for Mailrify

Project description

Mailrify Python SDK

CI Release

Official Python client for the Mailrify transactional and marketing email API.

Installation

Install from PyPI (Python 3.9+):

pip install mailrify

Quickstart (Sync)

import mailrify

mailrify.api_key = "YOUR_API_KEY"

params: mailrify.Emails.SendParams = {
    "to": ["customer@example.com"],
    "from": "you@yourdomain.com",
    "subject": "Welcome!",
    "text": "Hello from Mailrify!",
}

email: mailrify.Emails.SendResponse = mailrify.Emails.send(params)
print(email)

Quickstart (Async)

import asyncio
import mailrify


async def main() -> None:
    async with mailrify.AsyncClient(api_key="YOUR_API_KEY") as client:
        email = await client.emails.send(
            {
                "to": ["customer@example.com"],
                "from": "you@yourdomain.com",
                "subject": "Welcome!",
                "html": "<strong>Hello from Mailrify!</strong>",
            }
        )
        print(email.email_id)


asyncio.run(main())

Project Layout

  • src/mailrify/: core SDK implementation
  • scripts/sync_openapi.py: fetches the OpenAPI spec and regenerates models
  • tests/: unit and integration tests (to be added)

Development Setup

python -m venv .venv
source .venv/bin/activate
pip install -e .[dev]

Run quality gates:

ruff check src tests
black --check src tests
mypy src
pytest

Integration Tests

Integration tests exercise the live Mailrify API and are skipped unless you opt in. Export the required credentials first:

export MAILRIFY_API_KEY="your_live_api_key"
export MAILRIFY_INTEGRATION_FROM="verified-sender@yourdomain.com"
export MAILRIFY_INTEGRATION_TO="recipient@example.com"
# optional override
export MAILRIFY_BASE_URL="https://app.mailrify.com/api"

Then run:

pytest -m integration

The suite currently includes a smoke test for listing emails and sending a single message; ensure the addresses you provide are valid in your Mailrify account.

Contributing

Contributions are welcome! Please open an issue or pull request after reading CONTRIBUTING.md.

License

Distributed under the terms of the MIT License.

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

mailrify-0.0.3.tar.gz (15.6 kB view details)

Uploaded Source

Built Distribution

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

mailrify-0.0.3-py3-none-any.whl (17.3 kB view details)

Uploaded Python 3

File details

Details for the file mailrify-0.0.3.tar.gz.

File metadata

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

File hashes

Hashes for mailrify-0.0.3.tar.gz
Algorithm Hash digest
SHA256 aca37c6971fd703235cc51dae22e5a7c86bde3715bf84de7e3a36f487f524bb7
MD5 45e52bd02efb319162b2139a3e447cbc
BLAKE2b-256 89a19768a75ffa86ec7aa7c590559537526f2ed05751d1680f5870966c144e39

See more details on using hashes here.

Provenance

The following attestation bundles were made for mailrify-0.0.3.tar.gz:

Publisher: release.yml on Mailrify/mailrify-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 mailrify-0.0.3-py3-none-any.whl.

File metadata

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

File hashes

Hashes for mailrify-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 6dcc5222e5db22330d3a52702c99b317ef70ca7347744ea590e4446c75214103
MD5 c9dcc486e66d8afca9073dba24fc0921
BLAKE2b-256 e7a6f1b0eab94b0396f9358b413ccead13dbade549777f0270666c27fb4b7e6c

See more details on using hashes here.

Provenance

The following attestation bundles were made for mailrify-0.0.3-py3-none-any.whl:

Publisher: release.yml on Mailrify/mailrify-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