Send a plain-text email
To send a plain-text email (i.e. one that appears to be sent manually) via the Encharge Transactional Email API, specify the text
parameter. You'll also need to provide the email subject as subject
and the sender email as from
const axios = require('axios');
// Send a POST request
axios({
method: 'post',
url: 'https://api.encharge.io/v1/emails/send?token=yourAPIKey',
data: {
"to": "recipient@example.com",
"from": "sender@acme.org",
"subject": "Welcome",
"text": "Hello and welcome, {{ person.firstName }}!",
/**
* 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 text or subject.
*/
"templateProperties": {
"loginURL": "https://app.encharge.io/login/3n2l3ad99"
}
}
});
Last updated
Was this helpful?