# Send an email from template

To send an email from a prepared template, set the `template` parameter to the template name.&#x20;

To create a new email template, open the [Emails section](https://app.encharge.io/emails) in Encharge and click the + icon in the lower-left. You can skip this step if you've already created your email template.

{% hint style="info" %}
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](https://app.encharge.io/settings/person-fields).
{% endhint %}

```javascript
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",
    "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"
    }
  }
});
```

{% hint style="warning" %}
If you provide the `from` parameter, it will overwrite the sender address specified in the template.
{% endhint %}

{% hint style="info" %}
To use the template ID instead of the template name, pass a number to the `template` parameter above. \
Finding the template ID is easy - open the template in the Encharge app. Look at the URL to find the email ID. In the following URL [https://app.encharge.io/emails?email=123](https://app.encharge.io/emails?emails-folder-item=allEmails\&email=40995), the template ID is 123.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.encharge.io/transactional-email-api/send-an-email-from-template.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
