Skip to content

Email & SMTP Service

Summary

Send email alerts and notifications with your Murano solution. Your Murano plan provides you a limited amount of free emails for evaluation purposes. If your solution requires additional emails, consider setting up your own SMTP relay server.

You can check your current usage with the getSettings operation.
Before you can use this service, you need to add your email credentials in the service configuration. You can refer to the "configuration" section in following doc for instructions of setting your service configuration

Operations

Name Tag Summary
email.send() Email send an email
email.getSettings() Settings get email settings

Configuration parameters

Name Type Description
connection_server string(hostname) Connection_server (the SMTP server host name)
connection_user [\s\t\r\n\f]*$ Connection_user (the SMTP server account)
connection_password string(password) Connection_password (the SMTP server password)
connection_port integer Connection_port (the SMTP server port)
connection_scheme "smtp", "smtps", "" Connection_scheme (The SMTP server URL scheme, must be either 'smtp' or 'smtps')
Default: "smtp"
connection_require_starttls boolean Connection_require_starttls (Require STARTTLS connection upgrade)

Operations

send

Description

Send an email message.
If the connection.server attribute is omitted, a limited amount of emails per day are allowed depending on your Murano plan and the email sender is automatically set to mailrelay@exosite.com email address.

Arguments

Name Type Description
cc [ string(email) ] Carbon copy destination(s) email address(es)
to [ string(email) ] Destination(s) email address(es)
bcc [ string(email) ] Blind carbon copy destination(s) email address(es)
from string(email) Sender email address, only available when specifying an SMTP relay server with connection.server.
html string(html) Email message in HTML format
text string Email message text
subject string Email subject following RFC2822 standard. Recommended length not to be over 78 characters.
connection object An SMTP connection information to avoid daily limitation and sender email restriction. Gmail user will need to activate the "lesssecureapps" mode on https://support.google.com/accounts/answer/6010255.
connection.port integer The SMTP server port
connection.user [\s\t\r\n\f]*$ The SMTP server account
connection.scheme "smtp", "smtps" The SMTP server
Default: "smtp"
connection.server string(hostname) The SMTP server host name
connection.password [\t\r\n\f]*$ The SMTP server password
connection.require_starttls boolean Require STARTTLS connection upgrade

Responses

  • Returns {object} when Email successfully sent

    Email transmission details {object}

    Name Type Description
    accepted [ string(email) ] List of destination emails
    envelope object Email envelope details
    rejected [ string(email) ] List of rejected destination emails
    response string Response from smtp server
    messageId string Unique message Id
  • Returns nil for Daily email quota reached. Consider adding your personal SMTP server or contact Murano team for upgrading your plan. You can view your current email usage with _getSettings operation or on your Murano portal account._

  • Returns nil for Destination email address has been blocked due to too many bounces or complaints.

  • Returns {object} when Failed to send email. Detailed error is available in the service response.

    Error response {object}

    Name Type Description
    type string Error type
    error string Error message
    status integer Response code

Example

local emailData = {
  from = "me@myemail.com",
  to = {
    "destination1@email.com",
    "destination2@email.com",
  },
  subject = "Hello",
  text = "World",
  html = "<p><b>World</b></p>",
  connection = {
    server = "smtp.myemail.com",
    port = 1234,
    user = "me",
    password = "mysecret"
  }
}
local result = Email.send(emailData)

getSettings

Description

Get email settings, current usage, and quota. Detailed error is available in the service response.

Responses

  • Returns {object} when Email usage information

    Usage and settings information {object}

    Name Type Description
    quota object Free Email quota limitation for this solution.
    quota.daily integer Daily quota, reset midnight UTC time.
    usage object Current email usage for this solution.
    usage.daily integer Daily usage, reset midnight UTC time. This value will not increase if you use your own SMTP server.
  • Returns {object} when Failed to get email settings

    Error response {object}

    Name Type Description
    type string Error type
    error string Error message
    status integer Response code

Example

local result = Email.getSettings()
print("I am using " .. result.usage.daily .. " out of my " .. result.quota.daily .. " free daily emails.")