Side effects that fire after a message is delivered — activity logging, in-app notifications, and the optional outbound email nudge.
Everything here is best effort. A notification that fails must never unsend a message that is already committed, so every function rescues, logs, and returns. Callers ignore the return value.
The phoenix_kit_emails integration
Inbox is an internal messaging system: messages live in this app's tables and
are read in this app's UI. But a user who isn't looking at the app won't know
a message arrived, so — when the host also runs phoenix_kit_emails — we
send a short "you have a new message" nudge to the recipient's real email
address.
That integration is deliberately soft. phoenix_kit_emails is not in this
module's mix.exs; Code.ensure_loaded?/1 decides at runtime whether the
nudge happens. Hosts running both modules get it for free, hosts running only
Inbox are unaffected, and neither release cycle is coupled to the other.
Summary
Functions
Whether the outbound email nudge is currently wired up — used by the admin UI to explain why the toggle does or doesn't do anything on this host.
Announces a sent message: one activity event per recipient (which core turns into that user's in-app notification), plus an optional email nudge.
Names of recipients with no email address on file — for callers that want to warn "these people won't get an email nudge" before sending, rather than discovering it in the logs afterwards.
Functions
@spec email_nudges_available?() :: boolean()
Whether the outbound email nudge is currently wired up — used by the admin UI to explain why the toggle does or doesn't do anything on this host.
@spec message_sent( PhoenixKitInbox.Schemas.Message.t(), PhoenixKitInbox.Schemas.Mailbox.t(), [ %{role: String.t(), mailbox: PhoenixKitInbox.Schemas.Mailbox.t()} ] ) :: :ok
Announces a sent message: one activity event per recipient (which core turns into that user's in-app notification), plus an optional email nudge.
bcc recipients are notified like anyone else — they just don't appear in
anyone else's recipient list.
Names of recipients with no email address on file — for callers that want to warn "these people won't get an email nudge" before sending, rather than discovering it in the logs afterwards.