Use Action Item to Send email

This example shows how a Lua script can be used to connect to an SMTP server and send emails using the esi-SMTP library.


The example can be loaded from a Console Display in DataStudio with the following simple Lua code:

local exm = require('esi-examples')
In Lua Security Mode Restrictive, for the installation script as well as the actual example to work, additional configuration of Lua permissions is required. See Lua Security for background information and examples.

The code above will create a folder structure "Examples/Sendmail" underneath the Core object in I/O Model.

Using the sendmail example

After the initial setup, the example will not be active:

Send Mail: Fresh Setup

Before an eMail can be send, configure the Lua script body of the Send HTML Mail object and provide the credentials to your SMTP server and an eMail recipient:

Send Mail: eMail Configuration

To activate the example and send an eMail, enable the Send HTML Mail object:

Send Mail: Start The Example

Once the eMail has been sent, the Send HTML Mail object will automatically disable itself to prevent repeated eMail delivery.