sendEmail

Top  Previous  Next

sendEmail requires that the email settings (SMTP server etc) are filled out on the settings dialog.

Definition

network.sendEmail( to, from, subject, plainBody, htmlBody, callback )

 

Name

Type

Description

to

string

recipient for example sales@promixis.com.

from

string

sender santa@clause.com

subject

string

Subject of the email.

plainBody

string

The plain text email body. Note that either plainBody or htmlBody or both must be provided. If you wish not to provide either plain or html place an empty string in place.

htmlBody

string

The HTML text email body.

callback

function

The callback is called after email was successfully sent. Note this does not mean the email was successfully received.

Callback function signature

function ( success )

Name

Type

Description

success

boolean

Set to true if email was sent successfully, false otherwise.

Example

local body = [[

Dear Promixis,

 

Can we get another good deal on the 432,312,364

Girder Pro licenses we need this year? Can you

deliver these as CD's so we can put them under

the trees of all the good home automation fans?

 

Sincerely

 

 Mr. Claus

]]

 

network.sendEmail( "sales@promixis.com", "santa@clause.com", "Licenses for Christmas", body, "", function(success)

 if success then

         print("Email sent")

 else

         print("Email send failed")

 end

end )

 

This will print

 

Email sent

Related

get

post

Availability

Lua

Actions