MailglassInbound.InboundMessage (MailglassInbound v0.1.0)

Copy Markdown View Source

Canonical normalized inbound message passed to routing and mailbox code.

MailglassInbound.InboundMessage is the stable adopter-facing contract for the first inbound package slice. It models the normalized fields Mailglass can promise across first-party ingress providers while keeping raw payloads, signature evidence, replay metadata, and mailbox execution state out of the public struct.

Stable Fields

  • :tenant_id - explicit tenant scope for routing and execution.
  • :provider - first-party ingress provider name.
  • :provider_message_id - provider-specific message reference when present.
  • :message_id - RFC Message-ID header value when present.
  • :envelope_recipient - SMTP/envelope recipient used for routing.
  • :from, :to, :cc, :bcc, :reply_to - normalized address data.
  • :subject - normalized message subject.
  • :headers - normalized header map for routing and mailbox reads.
  • :sent_at, :received_at - normalized timestamps.
  • :text_body, :html_body - normalized body fields.
  • :attachments - normalized attachment manifest without attachment bytes.

Summary

Types

address()

@type address() :: %{:address => String.t(), optional(:name) => String.t() | nil}

attachment()

@type attachment() :: %{
  optional(:filename) => String.t() | nil,
  optional(:content_type) => String.t() | nil,
  optional(:disposition) => :attachment | :inline | String.t() | nil,
  optional(:content_id) => String.t() | nil
}

provider()

@type provider() :: :postmark | :sendgrid | String.t()

t()

@type t() :: %MailglassInbound.InboundMessage{
  attachments: [attachment()],
  bcc: [address()],
  cc: [address()],
  envelope_recipient: String.t() | nil,
  from: [address()],
  headers: %{optional(String.t()) => [String.t()]},
  html_body: String.t() | nil,
  message_id: String.t() | nil,
  provider: provider() | nil,
  provider_message_id: String.t() | nil,
  received_at: DateTime.t() | nil,
  reply_to: [address()],
  sent_at: DateTime.t() | nil,
  subject: String.t() | nil,
  tenant_id: String.t() | nil,
  text_body: String.t() | nil,
  to: [address()]
}