Outbound SMTP Stage
The Outbound SMTP stage allows email-based messages to be sent from Klevr Integration Hub, including with attachments.
Stage Overview
The Outbound SMTP stage allows email-based messages to be sent from Klevr Integration Hub, including with attachments.
Stage Definition File Location
All Outbound SMTP stages are defined by creating an appropriately formatted JSON definition file in the following location:
interfaces
{businessUnitCode}
{domainCode}
{integrationName}
out
smtp
{STAGE_NAME}.json
Stage JSON Definition File Format
The JSON definition file for an Outbound SMTP stage is as follows:
{
"name": "stage-name",
"displayName": "Brief Stage Title",
"description": "Brief description of the stage.",
"enabled": "$env:STATUS_<INTEGRATION_NAME>",
"source": "source-event",
"concurrency": 10,
"fromEmail": "$env:SMTP_FROM_ADDRESS",
"toEmail": "$env:SMTP_TO_ADDRESS",
"ccEmail": "$env:SMTP_CC_ADDRESS",
"bccEmail": "$env:SMTP_BCC_ADDRESS",
"emailSubject": "Email Subject With <<VARIABLE>>",
"useEmailTemplateFromPayload": false,
"emailTemplate": "templates/path/to/email_template.html",
"templateVariables": {
"VARIABLE": "$env:VARIABLE"
},
"smtpDetails": {
"serverAddress": "$env:SMTP_SERVER_ADDRESS",
"userName": "$env:SMTP_USERNAME",
"password": "$env:SMTP_PASSWORD",
"port": "$env:SMTP_PORT",
"enableSSL": "$env:SMTP_ENABLE_SSL"
},
"leaseLockName": "lock-name",
"emitEvent": "previous-stage-name-1",
"preLogTransformSchemaFileName": "schemas/path/to/schema/schema-name.liquid",
"preLogTransformSchemaType": "liquid|javascript",
"preLogTransformFormat": "json|xml|csv"
}
| Property | Sub-Property | Description |
|---|---|---|
name | The name of the stage. | |
displayName | Optional (but highly recommended). A short (3 or 4 word) "display name" for the stage, used as a "title" of the stage in the Integration Hub Portal service's self-documentation capability. | |
description | Optional (but highly recommended). A brief (10 to 15 word) description of the stage, used as a brief description of the stage's purpose in the Integration Hub Portal service's self-documentation capability. For a more detailed explanation (when needed), use the stage markdown feature. | |
enabled | Optional boolean flag (true or false). Default is true. Generally set via a DevOps variable. Controls if the stage is deployed enabled or not. | |
source | The source event that the stage subscribes to. See Pub/Sub Model. Alternatively, sources may be supplied, and an array of one or more source events can be subscribed to. | |
concurrency | Optional number of concurrent runs permitted for the stage. Default is 10. | |
fromEmail | Required. The email address that the email message will be sent from, e.g. no-reply@yourdomain.com. | |
toEmail | Required. A semicolon-separated list of email addresses that the email message will be sent to via the To: field. | |
ccEmail | Optional. A semicolon-separated list of email addresses that the email message will be sent to via the CC: field. | |
bccEmail | Optional. A semicolon-separated list of email addresses that the email message will be sent to via the BCC: field. | |
emailSubject | Required. The email subject. The subject may contain <<VARIABLE>> values which will be replaced via the templateVariables setting below. | |
useEmailTemplateFromPayload | Optional boolean flag (true or false). Default is false. When true, the stage expects to be provided with a payload containing the email body to be sent. See the Required Payload Format details below. | |
emailTemplate | When the useEmailTemplateFromPayload value is false then the emailTemplate must be set, defining a file that contains the email body to be sent, in HTML format. The file may contain <<VARIABLE>> values which will be replaced via the templateVariables setting below. | |
templateVariables | An optional object of key/value pairs. Prior to deploying the stage, the email body file will be updated to replace any instances of <<VARIABLE>> in the emailTemplate file with the corresponding value from this object. This allows an email body file to be more easily used across different stages where only minor differences in the email body's content are required.The key/value pairs can also be used to replace variables in the emailSubject, regardless of if the email body is obtained via a payload or file. | |
smtpDetails | ||
serverAddress | Required. The hostname or IP address of the SMTP service to use to send the email. | |
userName | Required. The SMTP service's username for authentication. Leave blank if authentication is not required. | |
password | Required. The SMTP service's password for authentication. Leave blank if authentication is not required. | |
port | Required. The SMTP service port to use. | |
enableSSL | Required boolean flag (true or false). When true, uses SSL (TLS) to connect to the SMTP service. | |
leaseLockName | Optional. See Lease Locking. | |
emitEvent | When the email has been sent successfully, the stage will normally terminate. However, under certain circumstances, it may be desirable to continue workflow processing. The optional emitEvent field allows the payload of a previously run stage to be output as a message from this stage. The stage must have previously been executed in the run history of the overall Integration Hub integration, with the stage's exported payload details being present in the Cloud Event Attributes section. |
Pre-Logging Transformation
This stage supports the optional pre-logging transformation feature using the following fields:
preLogTransformSchemaFileNamepreLogTransformSchemaTypepreLogTransformFormat
See the Pre-Logging Transformation for details.
Required Payload Format
When configured with the useEmailTemplateFromPayload flag set to true, the stage must be triggered with a payload in the following format:
{
"EmailBody": "<p>HTML email body...</p>",
"EmailAttachments": [
{
"Filename": "report.pdf",
"ContentType": "application/pdf",
"ContentData": "<base64 content>"
}
]
}
| Property | Description | |
|---|---|---|
EmailBody | The email body in HTML format. | |
EmailAttachments | An optional array of attachments to include with the email being sent. | |
Filename | The filename to use for the attachment. | |
ContentType | The content type to use for the file attachment. | |
ContentData | The Base64 encoded content to be used for the file attachment. |
Last updated on