LUA object: email

The object allows sending an email. Emails are sent through an SMTP server. Currently the body of the email can only be plain text, not HTML.

AvailabilityThe object is returned by a method or a property of another object
email            = program.newemail()
email.username   = "help@nios4.dev"
email.password   = "password"
email.smtpserver = "smtp.gmail.com"
email.portserver = 587
email.enablessl  = true
email.subject    = "Mail Test"
email.body       = "Hi! This a mail test"

email.sendfrom = "help@nios4.dev"
email.sendto   = "mailto"
result = email.send()

addbcc

DescriptionAllows you to add a recipient in bcc to the email
Value Type
Formatemail.addbcc(mail)
TypeMethod
SystemsWindows, Web, Android, IOS, Mac OS
ParameterValue TypeDescription
mailstringThe email address to add
Examples
email.addbcc("info@d-one.info")

addcc

DescriptionAllows you to add a cc recipient to the email
Value Type
Formatemail.addcc(mail)
TypeMethod
SystemsWindows, Web, Android, IOS, Mac OS
ParameterValue TypeDescription
mailstringThe email address to add
Examples
email.addcc("info@d-one.info")

adddocument

DescriptionAllows you to add a document object as an attachment to the email. The attachment will be in PDF format
Value Type
Formatemail.adddocument(document, namefile)
TypeMethod
SystemsWindows, Web, Android, IOS, Mac OS
ParameterValue TypeDescription
documentdocumentThe object that contains the print to be sent
namefilestringThe name of the file that will be used to save the document in pdf format
Examples
email.adddocument(printer_order,"order.pdf")

addfile

DescriptionAllows you to add a file as an attachment to the email
Value Type
Formatemail.addfile(path)
TypeMethod
SystemsWindows, Web, Android, IOS, Mac OS
ParameterValue TypeDescription
pathstringThe full path name where to retrieve the file to be attached
Examples
email.addfile("c:/documents/drawing.dwg")

body

DescriptionSets the body of the email
Value Typestring
Formatstring = email.body
TypeProperty
SystemsWindows, Web, Android, IOS, Mac OS

bodydocument

DescriptionUses a print created from a document object saved in html format as the body of the email
Value Typestring
Formatstring = email.bodydocument
TypeProperty
SystemsWindows, Web, Android, IOS, Mac OS

clearcc

DescriptionDeletes all the emails inserted as cc
Value Type
Formatemail.clearcc()
TypeMethod
SystemsWindows, Web, Android, IOS, Mac OS
Examples
email.clearcc()

cleardocument

DescriptionDeletes all document objects inserted as attachments in the email
Value Type
Formatemail.cleardocument()
TypeMethod
SystemsWindows, Web, Android, IOS, Mac OS
Examples
email.cleardocument()

clearfile

DescriptionDeletes all files attached to the email as attachments
Value Type
Formatemail.clearfile()
TypeMethod
SystemsWindows, Web, Android, IOS, Mac OS
Examples
email.clearfile()

enablessl

DescriptionEnables or disables the use of SSL channel for sending emails
Value Typeboolean
Formatboolean = email.enablessl
TypeProperty
SystemsWindows, Web, Android, IOS, Mac OS

messageerror

DescriptionReturns the possible error in case of failed email delivery
Value Typestring
Formatstring = email.messageerror
TypeProperty
SystemsWindows, Web, Android, IOS, Mac OS

password

DescriptionSets the password for the email account to be used for sending
Value Typestring
Formatstring = email.password
TypeProperty
SystemsWindows, Web, Android, IOS, Mac OS

portserver

DescriptionSets the port of the mailbox to use for sending
Value Typeinteger
Formatinteger = email.portserver
TypeProperty
SystemsWindows, Web, Android, IOS, Mac OS

send

DescriptionProceeds with sending the emails
Value Typeboolean
Formatboolean = email.send()
TypeMethod
SystemsWindows, Web, Android, IOS, Mac OS
Examples
bool = email.send()

sendfrom

DescriptionSets the sender email address
Value Typestring
Formatstring = email.sendfrom
TypeProperty
SystemsWindows, Web, Android, IOS, Mac OS

sendto

DescriptionSets the recipient’s email address
Value Typestring
Formatstring = email.sendto
TypeProperty
SystemsWindows, Web, Android, IOS, Mac OS

smtpserver

DescriptionSets the smtp server address used for sending the email
Value Typestring
Formatstring = email.smtpserver
TypeProperty
SystemsWindows, Web, Android, IOS, Mac OS

subject

DescriptionSets the subject of the email
Value Typestring
Formatstring = email.subject
TypeProperty
SystemsWindows, Web, Android, IOS, Mac OS

username

DescriptionSets the user of the sending mailbox
Value Typestring
Formatstring = email.username
TypeProperty
SystemsWindows, Web, Android, IOS, Mac OS