Skip to main content

Official Python SDK for Mailrify

Project description

Mailrify Python SDK

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

Installation

The package is not published yet. Clone the repository and install in editable mode:

pip install -e .

Python 3.9 or higher is required.

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.2.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.2-py3-none-any.whl (17.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mailrify-0.0.2.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.2.tar.gz
Algorithm Hash digest
SHA256 ca9b8e0e6789e27d85e85142351442550433572044d104066598dcb6c18337a6
MD5 7b2599ab9f3153f53d7ff18ea3197b16
BLAKE2b-256 cbfa198f03a0ef24b228328dee35cdeb77ff2b3d9144353e06baf726bf1fa0ad

See more details on using hashes here.

Provenance

The following attestation bundles were made for mailrify-0.0.2.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.2-py3-none-any.whl.

File metadata

  • Download URL: mailrify-0.0.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 cefeeb23340b02948eb8ef97a2702f0d784bd2e155206224859341b904c42e4f
MD5 fcb37c79e3847c404b65279e57a310a1
BLAKE2b-256 94d771f5fd21f1a3da0aa8cdfc627e7d6910f1916d4f556b9b74fe6779cd8fa6

See more details on using hashes here.

Provenance

The following attestation bundles were made for mailrify-0.0.2-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