Mailglass.Suppression (Mailglass v0.1.0)

Copy Markdown View Source

Public preflight facade for suppression checks (SEND-04).

Thin wrapper over Mailglass.SuppressionStore.check/2 configured via:

config :mailglass, :suppression_store, Mailglass.SuppressionStore.Ecto  # default
config :mailglass, :suppression_store, Mailglass.SuppressionStore.ETS   # test-speed

Return shape

  • :ok when the recipient is not suppressed
  • {:error, %Mailglass.SuppressedError{type: scope}} on a suppression hit

Telemetry

Single-emit [:mailglass, :outbound, :suppression, :stop] with:

  • Measurements: %{duration_us: integer()}
  • Metadata: %{hit: boolean(), tenant_id: String.t()}

No PII — neither address nor stream appears in metadata. Context on the %SuppressedError{} carries tenant_id + stream only (stream is enum-narrow, not recipient-identifying).

Summary

Functions

Pre-send suppression check. Returns :ok when allowed, {:error, %SuppressedError{}} when blocked.

Functions

check_before_send(msg)

(since 0.1.0)
@spec check_before_send(Mailglass.Message.t()) ::
  :ok | {:error, Mailglass.SuppressedError.t()}

Pre-send suppression check. Returns :ok when allowed, {:error, %SuppressedError{}} when blocked.

Extracts the primary recipient from msg.swoosh_email.to and delegates to the configured SuppressionStore implementation.