Karta.Inbound.Endpoint (Karta v1.0.0)

Where a server's received mail goes (Karta.Inbound). Its kind is chosen when it is added and never changes:

  • :http - a POST of every message to url, in a format chosen when the endpoint is added: :karta (the default; JSON, signed as Standard Webhooks with the endpoint's secret), :raw (the message itself, message/rfc822, signed the same way), :postal (Postal's RawMessage, as JSON or form data by encoding, signed with the key of the endpoint's organisation; no secret of its own), :postal_hash (Postal's Hash, JSON or form data, signed with the same key), :mailgun (a Mailgun route's forward() post, form data, the raw MIME in form data, or JSON by encoding, signed with the endpoint's own secret, which is the signing key), :sendgrid (SendGrid's Inbound Parse with the raw MIME message) or :postmark (Postmark's inbound webhook with the raw MIME message). encoding is the format's own: json or form for Postal's two formats, form, mime or json for Mailgun's; the other parsed formats have one shape. A URL may carry a user name and password (https: only): they are taken out of url and kept, decoded and encrypted, in credentials ("user:password"), and sent as Basic authentication; a URL given without them removes them.
  • :smtp - the message relayed to the mail server at host and port (default 25), with the envelope it arrived with. tls: :opportunistic (default; STARTTLS when offered), :encrypted (STARTTLS required) or :verified (STARTTLS required and the certificate valid for host).
  • :address - the message forwarded to addresses (one to ten), with a sender rewritten by SRS (Karta.Inbound.SRS).

An HTTP endpoint in the :karta format may be notify-only (notify_only: true, set by Karta.Kantoor.mark_endpoint/3; nil otherwise): the push carries the message's metadata without raw, and the receiver fetches the body when it wants it. The dispatcher then neither reads the stored body nor applies its size limit to it. kantoor: true marks an endpoint of the Kantoor interface (Karta.Kantoor.Response). credential_id names the Kantoor key that registered the endpoint, or is nil for an endpoint an operator made (or whose key was deleted); the interface's ownership rules are in Karta.Kantoor.Attach.

secret and credentials are encrypted by Karta.Vault. An HTTP endpoint may also carry one extra header with a secret value, for a receiver that cannot check a signature (auth_header, auth_header_value; Karta.RequestAuth): it is sent beside the format's signature, never instead of it, and its value is shown once.

Summary

Functions

What input may set. The kind, and an HTTP endpoint's format, only while the endpoint is new. allow_http: true accepts http: URLs (otherwise only https:).

Whether an endpoint of this kind and format has a secret of its own.

The user name an HTTP endpoint's requests authenticate with, or nil.

Types

t()

@type t() :: %Karta.Inbound.Endpoint{
  __meta__: term(),
  addresses: term(),
  auth_header: term(),
  auth_header_remove: term(),
  auth_header_value: term(),
  credential: term(),
  credential_id: term(),
  credentials: term(),
  encoding: term(),
  format: term(),
  host: term(),
  id: term(),
  inserted_at: term(),
  kantoor: term(),
  kind: term(),
  name: term(),
  notify_only: term(),
  port: term(),
  secret: term(),
  server: term(),
  server_id: term(),
  tls: term(),
  updated_at: term(),
  url: term()
}

Functions

changeset(endpoint, attrs, opts \\ [])

@spec changeset(t(), map(), keyword()) :: Ecto.Changeset.t()

What input may set. The kind, and an HTTP endpoint's format, only while the endpoint is new. allow_http: true accepts http: URLs (otherwise only https:).

secret?(arg1, format)

@spec secret?(atom(), atom() | nil) :: boolean()

Whether an endpoint of this kind and format has a secret of its own.

user(endpoint)

@spec user(t()) :: String.t() | nil

The user name an HTTP endpoint's requests authenticate with, or nil.