Skip to content

Send E-mails/Alerts

Scenes may also send e-mails and alerts. An alert is a real time notification sent to single/multiple user/s of your organization.

The following scene send an e-mail to example@resiot.com

    email = "example@resiot.com"
    subject = "Example"
    object = "Hey this is a test!"
    emailsent = resiot_sendemail(email, subject, object)

    -- Sleep for 1 second (1000 ms)
    resiot_sleep(1000)

    if emailsent then
        resiot_globaldebug("E-mail successfully sent!")
    else
        resiot_globaldebug("Error sending e-mail")
    end

Result:
Result

The following scene, instead, send an alert to all users

    -- If you want to send an alert only to selected user/s 
    -- replace the first field with the desired users' e-mail
    -- resiot_alert("example@resiot.com, example2@resiot.com, example3@resiot.com", "Test Alert")
    notsent, err = resiot_alert("", "Test Alert")
    if notsent then
        resiot_globaldebug("Alerts successfully sent!")
    else
        resiot_globaldebug(err)
    end

Result:
Result