Module sendmail

Functions

sendmail (from, to, smtp_server, message, options) Send mail
sendmail (params) Send mail

Tables

FROM a table describe FROM header
TO a table describe TO headers
SERVER a table describe smtp server
MESSAGE a table describe message
SUBJECT a table describe subject
TEXT a table describe text part in message
FILE a table describe attached file in message One of fields path, data, file are required.
OPTIONS a table describe sendmail options
SEND_PARAMS Send mail params as single table

Fields

DEFAULT_CHARSET Default charset
DEFAULT_ENCODE Default encoding


Functions

sendmail (from, to, smtp_server, message, options)
Send mail

Parameters:

Returns:

  1. int or nil number of the sent messages
  2. string error message

Usage:

    sendmail('me@host', 'to@host', 'host', {'test', 'hello'})
sendmail (params)
Send mail

Parameters:

Returns:

  1. int or nil number of the sent messages
  2. string error message

Usage:

    sendmail('me@host', 'to@host', 'host', {'test', 'hello'})

Tables

FROM
a table describe FROM header

Fields:

  • title optional string title used in header (or first value of table)
  • address string email address
  • charset optional string title charset
  • encode optional string ecoding used for title
TO
a table describe TO headers

Fields:

  • title optional string title used in header (or first value of table)
  • address string or {string,...} email address
  • charset optional string title charset
  • encode optional string ecoding used for title
SERVER
a table describe smtp server

Fields:

MESSAGE
a table describe message

Fields:

  • subject string or SUBJECT (or first value of table)
  • text string or TEXT if no mime_type then 'text/plain' used (or second value of table)
  • html string or TEXT if no mime_type then 'text/html' used
  • file string, FILE or {FILE,...} path, file or array of files

Usage:

    msg = {'this is subject'}
    msg = {'this is subject';'this is text'}
    msg = {subject = 'this is subject';'this is text'}
    msg = {'this is subject';text='this is text'}
    msg = {'subject', 'text', file = 'path/to/file'}
SUBJECT
a table describe subject

Fields:

  • title string subject's title (or first value of table)
  • charset optional string title charset
  • encode optional string ecoding used for title
TEXT
a table describe text part in message

Fields:

FILE
a table describe attached file in message One of fields path, data, file are required. If no name and path is setted then name sets to basename of file.

Fields:

  • name string attachment's name
  • path optional string surce file path
  • data optional string content of attachment
  • file optional string opened file handle (io.open in binary mode)
  • charset optional string
  • encode optional string
  • mime_type optional string Default 'application/octet-stream'
  • disposition optional string Default 'attachment'
  • headers optional table
OPTIONS
a table describe sendmail options

Fields:

  • confirm_sending boolean
SEND_PARAMS
Send mail params as single table

Fields:

Fields

DEFAULT_CHARSET
Default charset
DEFAULT_ENCODE
Default encoding
generated by LDoc 1.3