Skip to main content

Provider-abstracted email SDK for Herfy applications — send via Control Center credentials

Project description

herfy-email

Provider-abstracted email SDK for Herfy applications. Send transactional email using only your Control Center client_id and client_secret — no email provider credentials in app config.

Installation

pip install herfy-email[mailgun]

Usage

from herfy_email import HerfyEmailClient, AsyncHerfyEmailClient

# Sync
client = HerfyEmailClient.from_credentials(
    client_id="app_pettycash",
    client_secret="your_secret",
    control_center_url="https://cc.herfy.com",
)
client.send(to="user@herfy.com", subject="Hello", html="<p>Hello</p>", text="Hello")

# Async (FastAPI)
client = AsyncHerfyEmailClient.from_credentials(
    client_id="app_pettycash",
    client_secret="your_secret",
    control_center_url="https://cc.herfy.com",
)
await client.send(to="user@herfy.com", subject="Hello", html="<p>Hello</p>", text="Hello")

# From environment variables (CC_CLIENT_ID / AUTH_CLIENT_ID, CC_CLIENT_SECRET / AUTH_CLIENT_SECRET, CC_URL / CONTROL_CENTER_URL)
client = HerfyEmailClient.from_env()

How it works

  1. SDK authenticates with Control Center via POST /api/app-auth/token (cached, TTL 300s)
  2. SDK fetches provider config from GET /api/config/email (cached for process lifetime)
  3. SDK calls the configured provider (Mailgun, SendGrid, …) directly

Switching email providers requires only a Control Center env-var change — zero app changes.

Provider support

Provider Extra
Mailgun pip install herfy-email[mailgun]
SendGrid pip install herfy-email[sendgrid]

Control Center configuration

EMAIL_PROVIDER=mailgun
MAILGUN_API_KEY=key-xxxxxxxxxxxxxxxxxxxxxxxx
MAILGUN_DOMAIN=mg.herfy.com
MAILGUN_FROM_ADDRESS=noreply@herfy.com

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

herfy_email-1.0.0.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

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

herfy_email-1.0.0-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file herfy_email-1.0.0.tar.gz.

File metadata

  • Download URL: herfy_email-1.0.0.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for herfy_email-1.0.0.tar.gz
Algorithm Hash digest
SHA256 80be0264007348eb8bb2eae28692923d42348c7302c9e9b63f4ff8feecc4d541
MD5 c37d2121ba56860d1f26c6f9d438a595
BLAKE2b-256 5bcf20fe541644b8b5bcd1c65cf2ff87a9948d8856c72d613f25e6dbf4f00568

See more details on using hashes here.

Provenance

The following attestation bundles were made for herfy_email-1.0.0.tar.gz:

Publisher: publish-email-sdk.yml on Herfy-Food-Services/herfy-shared-library

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

File details

Details for the file herfy_email-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: herfy_email-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for herfy_email-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ae2c7c583fe1d632d2cb569c08b7d53d485c4ffc5720af8117ce9d9b92832ef8
MD5 46dee0a49e26f948977129fc18652b9a
BLAKE2b-256 fb216a335c866662641544bbded5924d4ef1eabd3f78fd32a2a0b9f95cd80bd4

See more details on using hashes here.

Provenance

The following attestation bundles were made for herfy_email-1.0.0-py3-none-any.whl:

Publisher: publish-email-sdk.yml on Herfy-Food-Services/herfy-shared-library

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