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
If you have previously created the recipient in Encharge, you can use personalization tags, for example {{ person.firstName }} in your email's text. See what fields you can use in Person Fields.
1
const axios = require('axios');
2
3
// Send a POST request
4
axios({
5
method: 'post',
6
url: 'https://api.encharge.io/v1/emails/send?token=yourAPIKey',
7
data: {
9
"from": "[email protected]",
10
"subject": "Welcome",
11
"text": "Hello and welcome, {{ person.firstName }}!",
12
/**
13
* Optionally, you can include a dictionary of fields to be replaced.
14
* For example, passing
15
* `{ "loginURL": "https://app.encharge.io/login/3n2l3ad99"}`
16
* will replace
17
* `{{ loginURL }}` in the email text or subject.
18
*/
19
"templateProperties": {
20
"loginURL": "https://app.encharge.io/login/3n2l3ad99"
21
}
22
}
23
});
Copied!
Last modified 1yr ago
Copy link