Skip to content

Email

Purpose

Send templated transactional email with audit trails.

How it works

Template-based transactional email only. Recipient modes restrict who may be emailed. Deliveries are recorded for audit. Browser clients cannot send arbitrary mail.

Client sites integrate in two ways:

  1. Forms — browser submit with site key; platform sends confirmation / staff notification.
  2. Server notifications — trusted backend calls POST /api/v1/server/notifications/ (or the Python SDK).

SMTP and From-address defaults live on the platform (EMAIL_BACKEND / DEFAULT_FROM_EMAIL). Individual ClientSites can also link an SmtpConnection (Improvmx, Google Workspace, or generic SMTP) from Site Onboarding or Django Admin. When a site has an active connection with a decryptable password, outbound sends use that host instead of the platform backend.

Stored SMTP passwords are encrypted with Fernet via MKP_ENCRYPTION_KEY (required for per-site SMTP). Passwords are write-only in Admin and onboarding APIs (has_password only in JSON).

Site Onboarding (Ajax sections)

/platform/sites/onboarding/ saves each panel independently:

  1. ClientSite identity
  2. Support email
  3. Improvmx alias forwarding (separate from SMTP send credentials)
  4. Outbound SMTP (provider presets, Save / Clear / Send test email)
  5. Domains & callbacks (already one-at-a-time)
  6. Capabilities
  7. Credentials / OAuth
  8. Scaffold

After SMTP credentials are saved, staff can send a short connectivity test to their own inbox (or any address) without waiting for a real form submission.

Live prototype — form emails

Submit the form below. On success the platform sends:

  1. Confirmation to the address you enter
  2. Staff notification to the docs site support_email

In development, message bodies print to the platform console. Always check Email deliveries in admin.

Form → email gateway

Use a real inbox you can check, or any address and rely on console + admin audit rows.

Code to paste (forms path)

<!-- Loads when the live demo config is available -->

Live prototype — server notification

Trusted backends normally call /api/v1/server/notifications/ with a server secret. The control below uses a docs-only proxy so the browser never holds that secret, while still creating a real EmailDelivery.

Server notification demo

Template code: docs.demo_notification

Code to paste (server path)

from mkp_client import MKPClient

client = MKPClient(
    base_url="https://YOUR_PLATFORM_ORIGIN",
    client_id="skpub_...",
    client_secret="sk_...",
)
client.notifications.send(
    "docs.demo_notification",
    "user@example.com",
    context={"payload": {"name": "Ada"}, "demo_note": "hello"},
)