Email Service
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 credentails in the service configuration. You can refer to the "configuration" section in following doc for instructions of setting your service configuration - http://docs.exosite.com/reference/ui/send-notifications/.
Operations
- Email.send() - send an email
Settings
- Email.getSettings() - get email settings
Operations
send
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
parameters - object - Object containing service call parameters.
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 {..78} | Email subject |
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-]+$ | 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 |
Responses
Email successfully sent
Content: object Email transmission details
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 |
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.
Content: nil
Failed to send email. Detailed error is available in the service response.
Content: object Error response
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)
Settings
getSettings
Get email settings, current usage, and quota. Detailed error is available in the service response.
Responses
Email usage information
Content: object Usage and settings information
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. |
Failed to get email settings
Content: object Error response
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.")