Problem (Why)
Pushi currently sends email only through raw SMTP, which requires each deployment to manage its own mail server credentials, deliverability and TLS configuration. Hive Solutions already runs Mailme, a simple REST email gateway with an official Python client (mailme-api), that removes that operational burden. Adding a Mailme adapter lets pushi apps send email through the managed gateway with just an API key, as an alternative to the SMTP handler.
Description (What)
Introduce a MailmeHandler adapter that delivers pushi events as emails via the Mailme REST gateway, with a Mailme subscription model, REST controller and API client mirroring the SMTP adapter. Recipient addresses are stored per subscription and overridable per published event, with subject/content derived from the event payload. Configuration uses Mailme's own convention (MAILME_BASE_URL, MAILME_KEY) alongside App-model fields, consistent with the existing credential pattern.
Implementation (How)
- Add
MailmeHandler(handler.Handler) in src/pushi/base/mailme.py implementing load, add, remove, subscribe, unsubscribe, send(app_id, event, json_d, invalid={}) and a direct send_to_receivers(...); honor per-event receiver/subject overrides over the stored subscription.
- Prefer the
mailme-api Python client (pip install mailme-api) if available, with a netius.clients.HTTPClient POST to MAILME_BASE_URL as a fallback; guard the import like the existing py_vapid optional dependency.
- Add App-model config fields in
src/pushi/app/models/app.py (mailme_base_url, mailme_key) with global env-var fallbacks (MAILME_BASE_URL, MAILME_KEY) via appier.conf.
- Add the
Mailme subscription model in src/pushi/app/models/mailme.py with fields (email, event) and handler-sync lifecycle hooks.
- API: add a
MailmeController in src/pushi/app/controllers/mailme.py exposing GET/POST /mailmes and DELETE /mailmes/<email>.
- API client: add
MailmeAPI in src/pushi/api/mailme.py with create_mailme / delete_mailme / subscribe_mailme / unsubscribe_mailme.
- Register the handler in
State.load_handlers() in src/pushi/base/state.py and export new symbols from the four __init__.py files.
- Add
mailme-api as an optional dependency in setup.py/requirements.txt.
- Add tests in
src/pushi/test/mailme.py (payload/auth, per-event override, subscription sync, optional-client fallback) using the mock-owner pattern.
- Update
README.md, add an examples/mailme/ example, and add a [Unreleased] CHANGELOG entry.
Problem (Why)
Pushi currently sends email only through raw SMTP, which requires each deployment to manage its own mail server credentials, deliverability and TLS configuration. Hive Solutions already runs Mailme, a simple REST email gateway with an official Python client (mailme-api), that removes that operational burden. Adding a Mailme adapter lets pushi apps send email through the managed gateway with just an API key, as an alternative to the SMTP handler.
Description (What)
Introduce a
MailmeHandleradapter that delivers pushi events as emails via the Mailme REST gateway, with aMailmesubscription model, REST controller and API client mirroring the SMTP adapter. Recipient addresses are stored per subscription and overridable per published event, with subject/content derived from the event payload. Configuration uses Mailme's own convention (MAILME_BASE_URL,MAILME_KEY) alongside App-model fields, consistent with the existing credential pattern.Implementation (How)
MailmeHandler(handler.Handler)insrc/pushi/base/mailme.pyimplementingload,add,remove,subscribe,unsubscribe,send(app_id, event, json_d, invalid={})and a directsend_to_receivers(...); honor per-event receiver/subject overrides over the stored subscription.mailme-apiPython client (pip install mailme-api) if available, with anetius.clients.HTTPClientPOST toMAILME_BASE_URLas a fallback; guard the import like the existingpy_vapidoptional dependency.src/pushi/app/models/app.py(mailme_base_url,mailme_key) with global env-var fallbacks (MAILME_BASE_URL,MAILME_KEY) viaappier.conf.Mailmesubscription model insrc/pushi/app/models/mailme.pywith fields (email,event) and handler-sync lifecycle hooks.MailmeControllerinsrc/pushi/app/controllers/mailme.pyexposingGET/POST /mailmesandDELETE /mailmes/<email>.MailmeAPIinsrc/pushi/api/mailme.pywithcreate_mailme/delete_mailme/subscribe_mailme/unsubscribe_mailme.State.load_handlers()insrc/pushi/base/state.pyand export new symbols from the four__init__.pyfiles.mailme-apias an optional dependency insetup.py/requirements.txt.src/pushi/test/mailme.py(payload/auth, per-event override, subscription sync, optional-client fallback) using the mock-owner pattern.README.md, add anexamples/mailme/example, and add a[Unreleased]CHANGELOG entry.