SendEMail@1
Der Node PlaceholderReplace@1 wird verwendet, um Platzhalter im Payload durch die angegebenen Werte zu ersetzen. Dieser Node wird üblicherweise zusammen mit einer Benachrichtigungsvorlage eingesetzt, um Platzhalter durch tatsächliche Werte zu ersetzen.
Adapter-Voraussetzungen
Node-Konfiguration
Für die Felder path, targetPath, targetValueWriteMode und targetValueKind siehe Überblick.
transformations:
- type: PlaceholderReplace@1 # Replace placeholders in the notification template
replaceRules: # List of placeholders to replace
- placeholder: placeholderName # Placeholder to replace, the placeholder should be in the format ${placeholderName} in payload
path: $.myValue # Path to the value to replace the placeholder with
path: $.body # Path to the payload
targetPath: $.resultBody # Path to store the result
Verwendungsbeispiel
Hier ist ein Beispiel, wie Sie den Node SendEMail@1 in einer Transformations-Pipeline verwenden könnten. In diesem Beispiel ruft der Node eine Benachrichtigungsvorlage namens emaildemo ab und speichert den Vorlagenkörper im Payload unter $.body und den Betreff unter $.subject.
Im Vorlagenkörper befinden sich zwei Platzhalter, tableData und firstName, die durch das Abfrageergebnis bzw. den Vornamen des Kunden ersetzt werden. Nach dem Ersetzen der Platzhalter wird die E-Mail an die angegebene E-Mail-Adresse gesendet.
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