API Reference phoenix_kit_emails v#0.3.0

Copy Markdown View Source

Modules

Email system for PhoenixKit - main API module.

Registers unified email provider on startup.

Archive and compress old email tracking data for optimal storage.

Shared "which AWS SES account(s) are actually active" resolution, used by everything that needs to reach AWS on behalf of the currently-configured sender(s): SQSPollingJob (the background poll), the per-account tracking settings in the "Amazon SES & SQS" section, and the "Delivery Event Tracking" panel's per-account opt-out list.

Thin wrapper around the Brevo transactional-email events API (GET /v3/smtp/statistics/events).

Normalizes a single event from Brevo's GET /v3/smtp/statistics/events response into the same event-data shape SQSProcessor.process_email_event/1 already accepts for AWS SES — see that function's @doc for the exact contract. SQSProcessor itself is untouched: every process_*_event/1 function stays SES-shaped, this module's only job is translating Brevo's vocabulary into it.

Shared "which Brevo account(s) are actually active" resolution, used by everything that needs to reach the Brevo events API on behalf of the currently-configured sender(s): BrevoPollingJob (the background poll), BrevoOnDemandSync (the "sync now" button), and the "Brevo Events" settings section's per-account opt-out list.

On-demand, targeted Brevo event fetch for a single email log — the Brevo-aware branch of the "sync status now" button (Details page and the emails list row menu both call it). Unlike BrevoPollingJob's broad polling cycle, this queries Brevo's events API filtered to exactly one messageId — the cheapest, most precise request the API supports.

Oban worker for polling the Brevo transactional-email events API.

Manager module for Brevo event polling via Oban jobs.

Email blocklist schema for storing blocked email addresses.

Struct representing extracted email data for logging.

Email event schema for managing delivery events in PhoenixKit.

Behaviour every provider delivery-event tracker implements (SES, Brevo, future Mailgun/…). See dev_docs/specs/2026-07-26-email-event-tracking-universalization-spec.md §4.1 for the full design rationale.

The correctness backbone of the tracker lifecycle (spec §4.3): a low-frequency Oban Cron entry that calls EventTrackerReconciler.reconcile/0 for every registered tracker.

Stateless reconcile — the single code path that starts/stops a tracker's self-scheduling Oban chain, enforcing EventTracker.should_run?/1. See spec §4.2/§4.3.

Emails-local registry of EventTracker implementations — decision §9.2 (option B) of the universalization spec: trackers all live in phoenix_kit_emails today (Mailgun would too), so a compile-time list here is simpler than a core module-registry callback for a cross-module need that doesn't exist yet. Revisit only if a tracker must ship from a different package.

Gettext backend for phoenix_kit_emails.

Email interceptor for logging outgoing emails in PhoenixKit.

Email logging for PhoenixKit - comprehensive logging in a single module.

Local metrics and analytics for PhoenixKit email tracking.

Module-owned versioned migrations for phoenix_kit_emails — the decentralized-migrations protocol core's mix phoenix_kit.update discovers via PhoenixKit.Module.migration_module/0: current_version/0 + migrated_version_runtime/1 + idempotent up/1 + version-aware down/1. PhoenixKit.Modules.Legal.Migrations is the reference implementation this chain is shaped after — same situation, and V1 here is the same kind of step: an ADOPTION, not a create.

Centralized path helpers for Emails module.

Unified email provider for PhoenixKit.

Decides whether an outgoing message is sent inline or handed to Oban.

Rate limiting and spam protection for the email system.

Oban worker for polling AWS SQS queue for email events.

Manager module for SQS polling via Oban jobs.

Processor for handling email events from AWS SQS messages.

Removes single-use authentication tokens from email bodies before they are persisted to the email log.

Delivers one queued message.

One snapshot of what the email system is actually doing right now.

Supervisor for PhoenixKit email tracking system.

Manages table column customization for email logs display.

Email template schema for managing reusable email templates.

Context module for managing email templates.

Utility functions for email handling in PhoenixKit.

Thin helper around Elixir's built-in JSON module (1.18+) for the one thing it doesn't provide: pretty-printing.

LiveView for managing email blocklist and blocked addresses.

LiveView for displaying detailed information about a specific email log.

LiveView for email tracking system settings and configuration.

LiveView for displaying and managing emails in PhoenixKit admin panel.

Controller for exporting email tracking data to CSV format.

LiveView for email metrics and analytics dashboard.

LiveView for email queue monitoring and rate limit management.

Public route definitions for Emails module. Admin LiveView routes are auto-generated from live_view: fields in admin_tabs/0.

The Amazon SES half of the "Delivery event tracking" panel: everything SES-specific behind the expanded aws_ses row — which Integrations connection supplies SES/SQS credentials, the per-account queues, one-click infrastructure setup, and the SQS worker's tuning knobs.

"Delivery event tracking" section on the core Email Sending settings page (/admin/settings/email-sending) — the unified, registry-driven admin panel from the universalization spec (dev_docs/specs/ 2026-07-26-email-event-tracking-universalization-spec.md §5). One row per EventTrackerRegistry.trackers/0 entry; a new provider (Mailgun, …) appears automatically once it registers, no panel code to touch.

"Email Tracking" section on the core Email Sending settings page (/admin/settings/email-sending).

LiveView for creating and editing email templates in PhoenixKit admin panel.

LiveView for displaying and managing email templates in PhoenixKit admin panel.

Secure webhook controller for AWS SNS email events.

Mix Tasks

Installs PhoenixKit Emails module into parent application.