CSML-by-Clevy / csml-engine

CSML is an easy-to-use chatbot programming language and framework.

Home Page:https://csml.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

add native SMTP client

frsechet opened this issue · comments

Is your feature request related to a problem? Please describe.
We often need to send emails from our chatbots. Would be neat to have a native SMTP client in CSML, rather than having to create an app!

Describe the solution you'd like

do data = do email = {
    // required
    "from": "John <john.doe@gmail.com>",
    "to": "Jane <jane.smith@hotmail.com>",
    
    // 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 <tony.stark@gmx.de>",
    "bcc": "James <james.bond@yahoo.com>",
    "cc": "toto@truc.com",
    "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(data) // mandatory to perform the request