SMTP Client

CSML includes a native SMTP client, allowing you to easily send emails from your chatbot.

do email = {
 // required
 "from": "John <>",
 "to": "Jane <>",
 // 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 <>",
 "bcc": "James <>",
 "cc": "",
 "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

Last updated