esi-smtp

A library for sending a mail using the simple mail transfer protocol via socket.smtp, wincurl or luacurl.

Dependencies

library version inmation core library

lcurl

0.3.9

yes

esi-string

1.0.3

yes

Available functions

All functions have to be called according to the ESI standard, using colons, e.g. lib:FUNCTIONNAME(params)

Documentation

SETMAILSERVERACCOUNT(self,user,pw,server,port,sendmode,ssl)

Mandatory function to setup the sending requirements

Parameters

user

The user account of the sender

pw

Password of the user account

server

The mailserver

port

The port of the server, commonly 25, 587 or 465

sendmode

The sendmode sets which sending method should be taken (CURL, LCURL or LUASMTP)

ssl

Enables or disables ssl requiring

Usage

lib:SETMAILSERVERACCOUNT("myuser@mydomain.com", "anyPass", "smtp.whatever.com", 587, lib.SENDMODE.CURL, true)

SETMAILINGLIST(self,name,rcps)

Register a mailing list that can be used using lib:SENDLIST

Parameters

name

The name of the mailing list

rcps

The recipients as a table

Usage

lib:SETMAILINGLIST("list", { "myemail@addres.one", "myemail@address.two" })

SEND(self,rcps,subj,content)

The executing function to send emails

Parameters

rcps

The recipients which should get the mail

subj

The subject of the mail

content

The mail content in Hyper Text Markup Language (HTML)

Returns

A response message, otherwise returns a error message

Usage

local respone, error = lib:SEND("myname@mydomaing.com", "My subject", "<p>My HTML code </p>")
if error then return error else return response end

SENDLIST(self,name,subject,content)

The executing function to send emails using a self defined mailing list

Parameters

name

The name of the mailing list

subj

The subject of the mail

content

The mail content in Hyper Text Markup Language (HTML)

Returns

A response message, otherwise returns a error message

Usage

local respone, error = lib:SENDLIST("listname", "My subject", "<p>My HTML code </p>")
if error then return error else return response end