-
Notifications
You must be signed in to change notification settings - Fork 8
Outputs: Email
The Email SMTP Output
The Email output node is used to send emails, as output from the flow.
This node will parse the parse the incoming response data and send the appropriate email.
Required fields can be picked up from the JSON message or from node properties themselves. For example, the email address to send the email to can be picked up from either message.content.to
or from the to
property of the node declaration inside the flow.
The code block below documents the format for the Email route node.
"route1":{
"type": "email",
"dependencies":"route0",
"host":"smtp.mailgun.org",
"port": 465,
"secure": true,
"user": "[email protected]",
"password": "<encrypted password goes here>",
"to": "[email protected]",
"from": "[email protected]",
"title": "New request was submitted",
"text": "New file has been submitted for processing.",
"html": "<p>New file has been submitted for processing.</p>"
}
The host
property is used to point to the SMTP host.
The port
is used to indicate the SMTP port.
secure
is true if the SMTP host is using SSL.
user
is the login ID for the SMTP server.
password
is the encrypted password for the SMTP server. The encryption can be done using this command
node [asb]/lib/crypt.js encrypt [text to encrypt]
to, from, title, text, and html
are the person to send the email to, from, subject of the email and the content of the email as text and HTML respectively. These properties can be picked from the message content or from the flow declaration.
attachments
property can be used to add attachments. It can be a path to the file to be attached, or a data URI e.g. data:text/plain;base64,aGVsbG8gd29ybGQ=
The following code block shows the email output being used to send an incoming file as an attachment via an email.
{
"flow":{
"name": "Email file notification",
"disabled": false
},
"listener": {
"type": "file",
"isMessageGenerator": true,
"path": "C:/test/in/*",
"donePath": "C:/test/done"
},
"route0":{
"type": "js",
"dependencies": "listener",
"module": "{{ESB_DIR}}/custom/email_custom.js"
},
"output": {
"type": "email",
"dependencies": "route0",
"host": "smtp.mailgun.org",
"port": 465,
"secure": true,
"user": "[email protected]",
"password": "<encrypted password goes here>",
"to": "[email protected]",
"from": "[email protected]",
"title": "New request was submitted",
"text": "New file has been submitted for processing.",
"html": "<p>New file has been submitted for processing.</p>"
}
}
(C) 2018 - 2021 TekMonks