Email & SMTP Service
Send email alerts and notifications with your West Connectivity solution.
The West Connectivity provides you the email service for monitoring purposes. If your solution requires specific policy settings and controls for emails, consider setting up your own SMTP relay server.
Operations
- Email.send() - send an email
Configuration parameters
Please note that bold arguments are required, while italic arguments are optional.
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) Maximum: 99999 |
connection_scheme | "smtp", "smtps", "" | Connection_scheme (The TLS secure option, if smtps the connection will use TLS when connecting to the server. Otherwise it just starts TLS handshake (STARTTLS extension)) Default: "smtp" |
hLimit | integer | A limit of email that can be send per hour, to limit potential miss-uses. Default: 10 |
Operations
Please note that bold arguments are required, while italic arguments are optional.
send
Send an email message.
You can specify the SMTP server to be used by including the connection.server attribute, otherwise the email is sent with the default server and the email sender is automatically set to no-reply@\<your_domain_name> email address.
SRS-ID: S-EMAIL-INT-001
Arguments
parameters (object) - Object containing service call parameters.
Name | Type | Description |
---|---|---|
hLimit | integer | A limit of email that can be send per hour, to limit potential miss-uses. Default: 10 |
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 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 Maximum: 99999 |
connection.user | ^[^\s\t\r\n\f]*$ | The SMTP server account |
connection.scheme | "smtp", "smtps" | The TLS secure option, if smtps the connection will use TLS when connecting to the server. Otherwise it just starts TLS handshake (STARTTLS extension) Default: "smtp" |
connection.server | string(hostname) | The SMTP server host name |
connection.password | ^[^\t\r\n\f]*$ | The SMTP server password |
Responses
Code | Body Type | Description |
---|---|---|
204 | object | Email successfully sent |
429 | nil | Destination email address has been blocked due to too many bounces or complaints. |
default | object | Failed to send email. Detailed error is available in the service response. |
Object Parameter of 204 response:
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 |
Object Parameter of default 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)
Service Health Check
Operations
/api/v1/solution/health
Enable the hosting system to check if service is active and running
SRS-ID: S-EMAIL-INT-003
Arguments
No Content
Responses
Name | Type | Description |
---|---|---|
200 | string | OK |
Errors
No content