Comment on page

SMTP Client

CSML includes a native SMTP client, allowing you to easily send emails from your chatbot.
do email = {
// required
"from": "John <[email protected]>",
"to": "Jane <[email protected]>",
// either html or text is required, both can be set
"html": "<h1>Hello in HTML!</h1>",
"text": "Hi there in plain text",
// optional
"reply_to": "Iron Man <[email protected]>",
"bcc": "James <[email protected]>",
"subject": "Happy new year",
do SMTP(hostname) // mandatory
.auth(username, password) // optional, defaults to no auth
.tls(true) // optional, defaults to auto upgrade to TLS if available
.port(465) // optional, defaults to 465
.send(email) // perform the send request