SendEMail@1
Node SendEMail@1
is used to send an email using the specified SMTP server configuration. The node requires the email subject and body to be provided in the payload. The email can be sent to one or more recipients.
This node needs an existing SMTP configuration. The configuration is created in the OctoMesh UI under the General/Configuration
tab. The configuration is used to connect to the SMTP server.
Adapter Prerequisites
Node Configuration
For fields targetPath
, targetValueWriteMode
, and targetValueKind
, see Overview. Field path
is not used in this node.
Configuration Options
The SendEMail@1
node provides flexible options for sending emails:
- serverConfiguration: Name of the global SMTP configuration object (required).
- cssConfiguration: Name of the global CSS configuration for email styling (optional).
- subjectPath: Path to the email subject in the payload (required).
- path: Path to the email body in the payload (required).
- toPath: Path to the recipient email addresses in the payload (required).
- ccPath: Path to a list of CC email addresses in the payload (optional).
- ccAddresses: Static list of CC email addresses (optional).
- bccPath: Path to a list of BCC email addresses in the payload (optional).
- bccAddresses: Static list of BCC email addresses (optional).
- attachmentRtIdPath: Path to the runtime ID of the attachment in the payload (optional).
- attachmentRtId: Runtime ID of the attachment entity (optional).
- attachmentFileName: File name for the attachment (optional).
- attachmentContentType: MIME type for the attachment (optional, defaults to
application/octet-stream
).
Usage Example
Here's an example of how you might use the SendEMail@1
node in a transformation pipeline. In this example, the node retrieves a notification template named emaildemo
and stores the template body in the payload at $.body
and the subject at $.subject
.
There are two placeholders in the template body, tableData
and firstName
, which are replaced with the query result and the customer's first name, respectively. After replacing the placeholders, the email is sent to the specified email address.
triggers:
- type: FromExecutePipelineCommand@1
transformations:
- type: GetNotificationTemplate@1 # Get the notification template
notificationTemplateName: emaildemo
targetPath: body
subjectTargetPath: subject
- type: GetRtEntitiesById@1 # Get the customer entity
ckTypeId: OctoSdkDemo/Customer
rtIds:
- 673b5e451c7375d2ea2bec85
targetPath: $.customer
- type: GetQueryById@1 # Get the query result
targetPath: $.query
queryRtId: 673b5c06de73e7b1755754e4
- type: QueryResultToMarkdownTable@1 # Convert the query result to a Markdown table
path: $.query
targetPath: $.table
- type: PlaceholderReplace@1 # Replace placeholders in the notification template
replaceRules:
- placeholder: tableData
path: $.table
- placeholder: firstName
path: $.customer.Attributes.FirstName
- placeholder: lastName
path: $.customer.Attributes.LastName
path: $.body
targetPath: $.resultBody
- type: SetPrimitiveValue@1 # Set the email address
value: "demo@demo.com"
targetPath: $.to
- type: SendEMail@1 # Send the email
serverConfiguration: smtptest
subjectPath: $.subject
path: $.resultBody
toPath: $.to
Notes:
- You can use both path-based and static list approaches for CC and BCC addresses.
- If both
attachmentRtId
andattachmentRtIdPath
are provided, the node will use the value from the payload path. - If
attachmentFileName
orattachmentContentType
is not provided, defaults will be used or an error will be logged.