Modules
Transactional email framework for Phoenix.
Behaviour every mailglass adapter implements (TRANS-01).
In-memory, time-advanceable test adapter (TRANS-02, D-01..D-03).
GenServer owning the :mailglass_fake_mailbox ETS table. Mirrors
Swoosh.Adapters.Sandbox.Storage pattern: the GenServer handles ownership
mutations (checkout, checkin, allow, set_shared, find_owner,
{:DOWN, ...}) but READS happen directly against ETS to bypass the mailbox.
Supervises Mailglass.Adapters.Fake.Storage. Started unconditionally in
Mailglass.Application (D-02) via the Code.ensure_loaded?/1-gated
maybe_add/3 call placed in Plan 01 (I-08).
Adapter bridging to any Swoosh.Adapter (TRANS-03).
Supervision tree for the Mailglass framework.
The single legitimate source of wall-clock time in mailglass (TEST-05).
Phase 6 LINT-12 NoDirectDateTimeNow forbids DateTime.utc_now/0
outside this module.
Test helper that freezes Mailglass.Clock.utc_now/0 in the current
process. Per-process isolation makes it async: true-safe.
Production clock impl. Wraps DateTime.utc_now/0.
Injects RFC-required and mailglass-specific headers into outbound messages.
Core unsubscribe token and URL service for RFC 8058 flows.
Core RFC 8058 unsubscribe controller.
HEEx function components for transactional email composition.
CSS style-string utilities for email component rendering.
Email document layout with MSO head and CSS reset.
Theme-token resolver backed by :persistent_term.
Runtime configuration for mailglass, validated at boot via NimbleOptions.
Raised when mailglass is misconfigured.
Runtime entrypoint for one-domain deliverability doctor runs.
BIMI readiness analyzer for the default selector only.
Explicit-selector DKIM analyzer.
Policy-aware DMARC analyzer.
Shared human and JSON renderers for deliverability results.
MX and Null MX analyzer for one organizational domain.
Mailglass-owned DNS resolver seam for deliverability checks.
Shared plain-data contract for mix mail.doctor runtime results.
Standards-aware SPF analyzer for one organizational domain.
Namespace and behaviour for the mailglass error hierarchy.
Raised by Mailglass.Outbound.deliver_many!/2 when one or more
deliveries in the batch have status: :failed.
Raised when the mailglass_events append-only immutability trigger fires.
Append-only event writer. The only legitimate path to
mailglass_events. Phase 6 NoRawEventInsert Credo check enforces
that no other code calls Repo.insert(%Event{}) or
Repo.insert_all("mailglass_events", ...).
Append-only row in mailglass_events.
Pure Ecto query functions for orphan-webhook reconciliation (D-19).
Gettext backend for mailglass default strings.
Generates deterministic idempotency keys for webhook deduplication and event-ledger entries.
Applies installer operations with deterministic ordering and outcome labels.
Conflict sidecar writer used when installer changes cannot be applied safely.
.mailglass.toml manifest helpers for deterministic installer reruns.
Typed operation contract used by the installer planner and apply engine.
Deterministic installer plan builder.
Installer template helpers for owned files and managed shared-file patches.
Transaction lifecycle seam for adopter-side event composition.
Default no-op lifecycle implementation.
Behaviour + use macro for adopter-defined mailable modules (AUTHOR-01).
A rendered or partially-rendered email message.
Public migration API for mailglass.
Internal migration runner for Postgres.
Serializes Mailglass.Tenancy.current/0 across Oban job boundaries (D-33).
Tenant-scoped read model for recent operator delivery browsing.
Tenant-scoped read model for replay audit history on one delivery.
Tenant-scoped read model for resolving a delivery detail selection to exact replayable webhook rows.
Tenant-scoped read model for operator support cues.
Tenant-scoped read model for operator suppression visibility.
Tenant-scoped read model for operator delivery event timelines.
Namespace for optional dependency gateway modules.
Gateway for the optional gen_smtp dependency ({:gen_smtp, "~> 1.3"}).
Gateway for the optional MJML NIF dependency ({:mjml, "~> 5.3"}).
Gateway for the optional Oban dependency ({:oban, "~> 2.21"}).
Gateway for the optional OpenTelemetry dependency ({:opentelemetry, "~> 1.7"}).
Gateway for the optional Sigra integration ({:sigra, "~> 0.2"}).
Public facade for the mailglass send pipeline (TRANS-04, SEND-01).
One row per (Message, recipient, provider) tuple. Mutable: projection
columns are updated by Mailglass.Outbound.Projector (Plan 06).
The single place where mailglass_deliveries projection columns are
updated (D-14). Consumed by Phase 3 dispatch, Phase 4 webhook ingest,
and Phase 4+ orphan reconciliation. No projection update happens
outside this module — a Phase 6 candidate Credo check
(NoProjectorOutsideOutbound) will enforce at lint time.
Oban worker that dispatches a queued Delivery (SEND-03). Conditionally
compiled — entire module elided when :oban is not loaded.
Name atom for the mailglass-owned Phoenix.PubSub child.
Typed topic builder for Mailglass.PubSub (SEND-05, D-27). Every topic
is prefixed mailglass: — Phase 6 LINT-06 PrefixedPubSubTopics
enforces the prefix at lint time.
Raised when installer golden drift is detected during the mix mailglass.publish.check task.
Raised when a rate limit is exceeded.
Multi-bucket ETS token bucket rate limiter (RATE-01).
Supervises Mailglass.RateLimiter.TableOwner (D-22).
Init-and-idle GenServer owning the :mailglass_rate_limit ETS table
(D-22). Owns nothing beyond ETS table creation — no handle_call/3,
handle_cast/2, or handle_info/2 implementations. Hot-path reads
and writes happen directly from caller processes via
:ets.update_counter/4 — NO GenServer mailbox serialization.
Pure-function render pipeline: HEEx → plaintext → CSS inlining → data-mg-* strip.
Thin facade over the host-configured Ecto.Repo.
Router macro for mounting Mailglass unsubscribe endpoints in an adopter Phoenix router.
Stamps mailglass-wide schema conventions onto a module.
Raised when email delivery fails.
Raised when webhook signature verification fails.
Stream policy seam (SEND-01 stage 3, D-25).
Raised when a message violates stream policy.
Raised when delivery is blocked by the suppression list.
Public preflight facade for suppression checks (SEND-04).
Centralized webhook-driven suppression projection helpers.
Ecto schema for a row in mailglass_suppressions.
Oban worker for async soft-bounce escalation.
Tenant-scoped suppression rebuild from the append-only event ledger.
Behaviour for suppression-list storage backends.
ETS-backed implementation of Mailglass.SuppressionStore (D-28).
Supervises Mailglass.SuppressionStore.ETS.TableOwner (D-22).
Init-and-idle GenServer owning the :mailglass_suppression_store ETS
table. Same pattern as Mailglass.RateLimiter.TableOwner (D-22).
Default Ecto-backed Mailglass.SuppressionStore implementation.
Telemetry integration for mailglass.
Behaviour for mailglass template engines.
Default HEEx template engine for mailglass.
Raised when a template cannot be compiled or rendered.
Tenancy behaviour + process-dict helpers.
Opt-in URL-prefix tenant resolver (D-12 sugar).
Default Mailglass.Tenancy resolver: scope/2 is a no-op;
resolve_webhook_tenant/1 returns {:ok, "default"}.
Raised when tenant context is required but not stamped on the process.
Test assertions extending Swoosh.TestAssertions (TEST-01, D-05).
Tracking public facade. Off by default per TRACK-01 / D-08.
Boot-time validator for TRACK-03 configuration (D-32).
Runtime auth-stream tracking guard (D-38).
Mountable Plug endpoint for open-pixel + click-redirect URLs (TRACK-03).
Pure HTML transform: open-pixel injection + click link rewriting (TRACK-03).
Phoenix.Token-signed tokens for open pixel + click redirect URLs (TRACK-03, D-33..D-35).
Webhook boundary root.
Custom Plug.Parsers :body_reader that preserves raw request
bytes in conn.private[:raw_body] for HMAC verification while
still allowing JSON parsing downstream.
Webhook ingest — the single Ecto.Multi that HOOK-06 reduces to.
Single-ingress webhook orchestrator (CONTEXT D-10).
Behaviour for webhook providers (SendGrid, Postmark, etc).
Mailgun webhook verifier + normalizer.
ETS-backed replay cache for Mailgun webhook tokens.
Owns the Mailgun replay cache ETS table.
Postmark webhook verifier + normalizer.
Resend webhook verifier + normalizer.
AWS SES webhook verifier via Amazon SNS.
ETS-backed SNS X.509 certificate cache for SES webhook signature verification.
Owns the SES SNS certificate cache ETS table.
SNS URL trust-policy validation — SSRF guard for cert and subscribe URLs.
SendGrid Event Webhook verifier + normalizer.
Oban cron worker that prunes mailglass_webhook_events rows by
status + age (CONTEXT D-16).
Reconcile orphan webhook events against committed deliveries.
Canonical tenant-scoped webhook replay command.
Router macro for mounting Mailglass webhook endpoints in an adopter Phoenix router.
Co-located span helpers for the webhook ingest surface (CONTEXT D-22).
Ecto schema for the mailglass_webhook_events table (V02 migration,
Plan 04-01). Mutable + prunable — UNLIKE mailglass_events which is
append-only via the SQLSTATE 45A01 trigger (CONTEXT D-15 split).
Mix Tasks
Run DNS-only deliverability checks for one explicit domain.
Fail the build if Tier 1 docs leak internal IDs or drift away from the canonical stability-contract story. The checks are deterministic and scoped to release-blocking docs only.
Scaffolds a new Mailable module and its associated HEEx template.
Generates the 8-line wrapper migration file in priv/repo/migrations/
that delegates up/0 and down/0 to Mailglass.Migration.
Prints the read-only Mailglass unsubscribe installation checklist.
Install mailglass into a Phoenix host app.
Verify the published tarball before Hex.pm release.
Manually trigger the same reconciliation sweep that
Mailglass.Webhook.Reconciler runs on its Oban cron schedule.
Ensures that Swoosh.Email.t() types do not leak into the Mailglass
public namespace, preventing downstream developers from accidentally coupling
to our internal engine's types.
Rebuilds mailglass_suppressions from the append-only event ledger for one tenant.
Transitional codemod that upgrades adopter code from raw Swoosh.Email
usage to native Mailglass.Message setters.
Manually trigger the same retention sweep that
Mailglass.Webhook.Pruner runs on its Oban cron schedule.