Karta.Messages.Message (Karta v1.0.0)

A stored message: metadata in Postgres, the body (with Karta's Received: field in front) encrypted in the blob store under blob_key.

Status:

  • :pending - being stored; never acknowledged to the client.
  • :accepted - stored and acknowledged.
  • :discarding - being removed (retention, or an abandoned :pending message): the row stays until its blob is gone.

Only a conditional update moves a row from :pending to :accepted, and only a conditional update moves it to :discarding, so at most one of them wins (see Karta.Messages).

mail_from is the envelope sender ("" for the null reverse path) and rcpt_to the envelope recipients; from_address, subject and message_id come from the header (best effort, nil when absent or unreadable). size is the stored body's size in bytes.

tag is a label the sender gave the message through a sending API; tags are all its labels (the first is tag) and variables the data the sender attached to it (both are shown with its events). send_at is when the sender asked for it to be sent (nil: at once). track_opens and track_clicks are false when the sender switched that tracking off for this message, nil when the server's setting applies (Karta.Tracking).

auth_results holds what Karta found out about the sender of a message it received (SPF, DKIM, DMARC: Karta.Auth.to_map/1); nil for mail that was not checked.

scan is what the spam and virus scanners said about a received message (Karta.Scan.stored/2: the score, rspamd's action and symbols, whether Karta called it spam, and the virus result); nil when nothing was scanned.

received_tls says whether the message was received over TLS (the formats that carry a message's fields tell the application). smtputf8 records that the client used SMTPUTF8 (RFC 6531); dsn_ret (:full or :hdrs) and dsn_envid are its RET and ENVID parameters (RFC 3461), for delivery status notifications; requiretls that it asked for REQUIRETLS (RFC 8689): delivery only over verified TLS to servers that support REQUIRETLS (Karta.Outbound.Transfer).

retention_keep and retention_days are an optional retention policy of an outgoing message sent through the Kantoor interface (Karta.Kantoor.Retention; nil for both: the server's setting), and source says what sent it ("kantoor"). An incoming message's policies are on its deliveries.

relay_credential_id names the IP range credential whose address range let the message in (Karta.SMTP.Relay); nil for a message submitted with AUTH or accepted for delivery.

Summary

Types

t()

@type t() :: %Karta.Messages.Message{
  __meta__: term(),
  auth_results: term(),
  blob_key: term(),
  created_at: term(),
  direction: term(),
  dsn_envid: term(),
  dsn_ret: term(),
  from_address: term(),
  id: term(),
  mail_from: term(),
  message_id: term(),
  rcpt_to: term(),
  received_tls: term(),
  relay_credential_id: term(),
  requiretls: term(),
  retention_days: term(),
  retention_keep: term(),
  scan: term(),
  send_at: term(),
  server: term(),
  server_id: term(),
  size: term(),
  smtputf8: term(),
  source: term(),
  status: term(),
  subject: term(),
  tag: term(),
  tags: term(),
  track_clicks: term(),
  track_opens: term(),
  updated_at: term(),
  variables: term()
}