Back to Blog

Sending Custom Email

Cloud code actions provides functionality to send e-mails.

Example use cases:

You can send an email using the toolbelt.email() method.

Sending HTML

We support sending (limited) HTML formatted email with custom emails.

async payload => {
  toolbelt.email({
    to: '[email protected]',
    message: '<div><h1>Example Title</h1><p>This is an HTML example</p></div>'
  })
}

Sending data with e-mails

Cloud code supports JavaScript template tags that allows you to send information, like parameters inside the payload.

Sending an email with the name of a user

async payload => {
  toolbelt.email({
    to: '[email protected]',
    message: `Some data extracted: ${payload.user.name}`
  })
}

Sending an email with a param

async payload => {
  toolbelt.email({
    to: '[email protected]',
    message: `Some data extracted: ${payload.params.city[0].value}`
  })
}
Start for freeContact us