Frontend (aka. primary interface) for interacting with an IMAP server.

Manages the full lifecycle of an IMAP session — from starting a connection (aka. server greeting) and authenticating, to selecting mailboxes and issuing arbitrary commands.

@typedoc """

  • :conn - A tuple with {socket_module, connection}.
  • :capability - Server capabilities reported after connecting (aka. server greeting) or executing CAPABILITY command.
  • :selected_mailbox - The currently selected mailbox, or nil if none is selected.
  • :mailboxes - List of mailboxes retrieved from the server.
  • :logged_in - Whether the session is currently authenticated. Defaults to false.
  • :tag_number - Internal counter used to generate unique command tags
                      (e.g. `1`  `"A001"`). Defaults to `0`.
  • :debug - When true, enables verbose logging of raw client/server
                      exchanges via `Logger`. Defaults to `false`.

Summary

Types

t()

@type t() :: %IMAP{
  capability: list() | nil,
  conn: any() | nil,
  debug: boolean(),
  logged_in: boolean(),
  mailboxes: list(),
  responses: term(),
  selected_mailbox: String.t() | nil,
  tag_number: non_neg_integer(),
  tagged_responses: term()
}

Functions

hangup(map)

imap_receive_raw(conn)

new(opts)

send_command(pid, command)

start_imap_connection(pid)