Send custom HTML email

If you'd like to set your own HTML for an email, use the html parameter.

To send a custom HTML email, send a request to the API as follows:

const axios = require('axios');

// Send a POST request
axios({
  method: 'post',
  url: 'https://api.encharge.io/v1/emails/send?token=yourAPIKey',
  data: {
    "to": "[email protected]",
    "from": "[email protected]",
    "subject": "Welcome",
    "html": "<div>Hello and welcome, <b>{{ person.firstName }}</b>!</div>",
    /**
   * Optionally, you can include a dictionary of fields to be replaced.
   * For example, passing
   * `{ "loginURL": "https://app.encharge.io/login/3n2l3ad99"}`
   * will replace
   * `{{ loginURL }}` in the email html or subject.
   */
    "templateProperties": {
      "loginURL": "https://app.encharge.io/login/3n2l3ad99"
    }
  }
});

Last updated

Was this helpful?