mailio_imap (mailio v0.2.0)
IMAP protocol adapter.
Implements mailio_adapter on top of mailio_imap_conn, turning the sync engine's normalized calls into IMAP command sequences and interpreting the untagged responses. Capability-gated: QRESYNC / CONDSTORE / MOVE are used when the server advertises them, with a UID-FETCH fallback otherwise.
Summary
Functions
Like fetch_message/4. With uidvalidity in Opts the message is only fetched when the mailbox still has that UIDVALIDITY; a UID means nothing under another one (RFC 3501, section 2.3.1.1), so the answer is {error, uidvalidity_changed}.
Types
-type conn() :: #{pid := pid(), caps := #{atom() => boolean()}, max_vanished => pos_integer(), listing_window => pos_integer(), max_untagged => pos_integer(), max_line => pos_integer(), max_list_commands => pos_integer()}.
Functions
-spec close(conn()) -> ok.
-spec connect(map()) -> {ok, conn()} | {error, mailio_error:error_map()}.
-spec fetch_changes_since(conn(), binary(), mailio_adapter:remote_state(), map()) -> {ok, [mailio_adapter:change()], mailio_adapter:remote_state(), more | done} | {error, term()}.
-spec fetch_message(conn(), binary(), term(), mailio_adapter:fetch_sink()) -> {ok, #{size := non_neg_integer()}} | {error, term()}.
-spec fetch_message(conn(), binary(), term(), mailio_adapter:fetch_sink(), map()) -> {ok, #{size := non_neg_integer()}} | {error, term()}.
Like fetch_message/4. With uidvalidity in Opts the message is only fetched when the mailbox still has that UIDVALIDITY; a UID means nothing under another one (RFC 3501, section 2.3.1.1), so the answer is {error, uidvalidity_changed}.
-spec list_mailboxes(conn()) -> {ok, [mailio_adapter:remote_mailbox()]} | {error, term()}.
-spec list_uids(conn(), binary(), #{max => pos_integer()}) -> {ok, [integer()]} | {error, term()}.
-spec mailbox_info(conn(), binary()) -> {ok, #{exists := non_neg_integer(), uidvalidity := pos_integer() | undefined}} | {error, term()}.
-spec state_uidvalidity(mailio_adapter:remote_state()) -> term().