Blop.Client (Blop v0.1.4)

View Source

Blop Client

It's supposed to be used in a GenServer. It starts a linked Agent to hold to the client state.

client = Client.new host: "imap.my.provider.com" Client.login(client, "my@provider.com", "my-unique-password") Client.list(client) Client.select(client, "INBOX") Client.fetch(client, "1:5")

Summary

Functions

Perform a EXAMINE command on a mailbox. Sets the currently selected mailbox in the client state.

Execute an IMAP command with the client.

Perform a FETCH command on the server to get a list of messages.

Return the client state.

Perform a LIST command on the server to get a list of mailboxes.

Log the client in to the server with the given username and password.

Create a new IMAP client.

Perform a SELECT command on a mailbox. Sets the currently selected mailbox in the client state.

Functions

examine(client, mailbox_name)

Perform a EXAMINE command on a mailbox. Sets the currently selected mailbox in the client state.

exec(client_agent, req)

Execute an IMAP command with the client.

fetch(client, sequence_set)

@spec fetch(pid(), sequence_set :: String.t()) :: [Mail.Message.t()]

Perform a FETCH command on the server to get a list of messages.

fetch(client, sequence_set, md_items_or_macro)

@spec fetch(pid(), sequence_set :: String.t(), md_items_or_macro :: String.t()) :: [
  Mail.Message.t()
]

info(client)

Return the client state.

info(client, key)

list(client, reference \\ ~s|""|, mailbox \\ "*")

Perform a LIST command on the server to get a list of mailboxes.

login(client, username, password)

Log the client in to the server with the given username and password.

new(opts)

Create a new IMAP client.

Accepted options:

  • :host - The hostname of the IMAP server. (required)
  • :port - The port of the IMAP server. Default is 993.
  • :socket_module - The socket module to use. Default is :ssl.
  • :login - A tuple with the username and password. This will be used to log in automatically after the client is created. Users can also call Client.login/3 manually.

Connection options:

For example when using :ssl

  • :ssl - A list of options to pass to :ssl.connect/4. Default is [:binary, active: false, cacertfile: CAStore.file_path()].

select(client, mailbox_name)

Perform a SELECT command on a mailbox. Sets the currently selected mailbox in the client state.