Karta.Kantoor.Messages (Karta v1.0.0)

What a Kantoor key may see of the server's stored messages (Karta.Kantoor.Restrictions):

  • an incoming message, when the key may touch the address of at least one of its deliveries that was not deleted (Karta.Kantoor.Deliveries);
  • an outgoing message, when the key may touch its envelope sender (mail_from).

Only accepted messages of the key's own server are ever found.

Summary

Functions

The accepted message id of the key's server with its deliveries (incoming messages only; [] for an outgoing one), or :error when there is none or the key may not see it.

A page of the accepted messages the key may see (Karta.Pager, by creation time then id). Options: direction (:incoming or :outgoing), rcpt (an address: an incoming message with a delivery to it, an outgoing message with it among its recipients; case-insensitive), since (a DateTime: created at or after it), order (:asc, the default, oldest first, or :desc), after (a cursor, the id of the last message of the page before) and limit (default 50).

The deliveries of messages (incoming ones) the key may see, by message id.

Functions

fetch(credential, id)

@spec fetch(map(), String.t()) ::
  {:ok, Karta.Messages.Message.t(), [Karta.Inbound.Delivery.t()]} | :error

The accepted message id of the key's server with its deliveries (incoming messages only; [] for an outgoing one), or :error when there is none or the key may not see it.

list(credential, opts \\ [])

@spec list(map(), keyword()) :: Karta.Pager.Page.t()

A page of the accepted messages the key may see (Karta.Pager, by creation time then id). Options: direction (:incoming or :outgoing), rcpt (an address: an incoming message with a delivery to it, an outgoing message with it among its recipients; case-insensitive), since (a DateTime: created at or after it), order (:asc, the default, oldest first, or :desc), after (a cursor, the id of the last message of the page before) and limit (default 50).

visible_deliveries(credential, messages)

@spec visible_deliveries(map(), [Karta.Messages.Message.t()]) :: %{
  required(Ecto.UUID.t()) => [Karta.Inbound.Delivery.t()]
}

The deliveries of messages (incoming ones) the key may see, by message id.