View Source Mailroom.IMAP (Mailroom v0.5.0)
Handles communication with a IMAP server.
Example:
{:ok, client} = Mailroom.IMAP.connect("imap.server", "username", "password")
client
|> Mailroom.IMAP.list
|> Enum.each(fn(mail) ->
message =
client
|> Mailroom.IMAP.retrieve(mail)
|> Enum.join("\n")
# … process message
Mailroom.IMAP.delete(client, mail)
end)
Mailroom.IMAP.reset(client)
Mailroom.IMAP.close(client)
Summary
Functions
Returns a specification to start this module under a supervisor.
Connect to the IMAP server
Fetches the items for the specified message or range of messages
Options
:timeout
- (integer) number of milliseconds before terminating the idle command if no update has been received. Defaults to1_500_00
(25 minutes)
Callback implementation for GenServer.init/1
.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
Connect to the IMAP server
The following options are available:
ssl
- defaultfalse
, connect via SSL or notport
- default110
(995
if SSL), the port to connect totimeout
- default15_000
, the timeout for connection and communication
Examples:
Mailroom.IMAP.connect("imap.server", "me", "secret", ssl: true)
{:ok, pid}
Fetches the items for the specified message or range of messages
Examples:
> IMAP.fetch(client, 1, [:uid])
#…
> IMAP.fetch(client, 1..3, [:fast, :uid])
#…
Options
:timeout
- (integer) number of milliseconds before terminating the idle command if no update has been received. Defaults to1_500_00
(25 minutes)
Callback implementation for GenServer.init/1
.