Send an email from template
To send an email from a prepared template, set the template
parameter to the template name.
To create a new email template, open the Emails section in Encharge and click the + icon in the lower-left. You can skip this step if you've already created your email template.
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]",
"template": "Welcome Email",
/**
* 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 template.
*/
"templateProperties": {
"loginURL": "https://app.encharge.io/login/3n2l3ad99"
}
}
});
If you provide the from
parameter, it will overwrite the sender address specified in the template.
Last updated
Was this helpful?