Mail library

Index:

Functions:

imap

imap

Synopsis
Reads messages from an IMAP account.
Usage
(imap
  "host" => host
  "port" => port
  "username" => username
  "password" => password
  "start" => start
  "end" => end
  "expunge" => expunge
)
Returns
(message ... message)
Where
  • host is string: the IMAP host.
  • port is string[0..1]: the IMAP port (typically 143).
  • username is string: the username of the imap account.
  • password is string: the password of the imap account.
  • start is number[0..1]: the index of the first message to retrieve. By default is 0.
  • end is number[0..1]: the index of the last message to retrieve. By default is 10.
  • expunge is boolean[0..1]: when true selected messages are removed. By default is false.
  • message is (
      "from" => from
      "subject" => subject
      "received" => received
      "body" => body
    )
    [0..N]: a message from the imap account.
  • from is string: the sender email address of the message.
  • subject is string: the subject of the message.
  • received is number: the date/time of receipt of the message expressed as the number of milliseconds ellapsed since january 1st 1970 00:00h.
  • body is string: the body of the message as text.
Description
Retrieves the messages from the specified IMAP account from start position to end position. If expunged is true, these messages are deleted from the server.
Examples
(imap
  "host" => "imag.brain4it.org"
  "port" => 143
  "username" => "demo"
  "password" => "demo"
)
(
  (
    "from" => "boss@brain4it.org"
    "subject" => "Meeting"
    "received" => 1508868595268
    "body" => "See you later."
  )
  (
    "from" => "dog@brain4it.org"
    "subject" => "Hungry"
    "received" => 1508868594123
    "body" => "I'm hungry..."
  )
)
smtp

smtp

Synopsis
Sends an email through the SMTP protocol.
Usage
(smtp
  "host" => host
  "port" => port
  "from" => from
  "to" => to
  "cc" => cc
  "bcc" => bcc
  "subject" => subject
  "body" => body
  "username" => username
  "password" => password
)
Returns
null
Where
  • host is string: the SMTP host.
  • port is string[0..1]: the SMTP port (typically 25).
  • from is string[0..1]: the sender email address.
  • to is object[0..1]: a string or a list of strings representing the recipient addresses.
  • cc is object[0..1]: a string or a list of strings representing the carbon copy recipient addresses.
  • bcc is object[0..1]: a string or a list of strings representing the blind carbon copy recipient addresses.
  • subject is string[0..1]: the subject of the message.
  • body is string[0..1]: the body of the message in plain text.
  • username is string[0..1]: the username of the smtp account.
  • password is string[0..1]: the password of the smtp account.
Description
Sends a text message to the given recipients through the specified SMTP service.
Examples
(stmp
  "host" => "stmp.brain4it.org"
  "port" => 25
  "from" => "admin@brain4it.org"
  "to" => "realor@brain4it.org"
  "subject" => "Hello"
  "body" => "Hello world"
)
Top