# Using the context. in Body of E-mail for rules and connection

**URL:** <https://discuss.elastic.co/t/using-the-context-in-body-of-e-mail-for-rules-and-connection/351728>\
**Category:** Kibana\
**Tags:** detection-rules\
**Created:** [January 24, 2024, 2:47pm UTC](https://discuss.elastic.co/t/using-the-context-in-body-of-e-mail-for-rules-and-connection/351728 "2024-01-24T14:47:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![NShrek](https://avatars.discourse-cdn.com/v4/letter/n/b487fb/32.png) [@NShrek](https://discuss.elastic.co/u/NShrek)\
**Post date:** [January 24, 2024, 2:47pm UTC](https://discuss.elastic.co/t/using-the-context-in-body-of-e-mail-for-rules-and-connection/351728/1 "2024-01-24T14:47:38Z")

</div>

Hello,

We are using the Elastic version v 7.16.3 .  
I am trying to create the alert notification by using the Rules and connectors.  
The rule is working fine. however I can't put the required data in the e-mail notification that I generate.

Test case 1: If I use the template e-mail in elastic no issue.

Test case 2: If i want to add more data and use the {{context.hits.\_index}} and get to the content of index and use the dot.dot to grab the data it is not working. Th mustach variable is not working. I reached out to everyone and still no resolution.

Sample screenshot of generated alert

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/8/8/88cb33083d3cc23d5fce96d2e538cceea2f75771.png)

Massage body is :

Elasticsearch query alert '{{alertName}}' is active:

```auto
- Value: {{context.value}}
- Conditions Met: {{context.conditions}} over {{params.timeWindowSize}}{{params.timeWindowUnit}}
- Timestamp: {{context.date}}
- **indextest:** *{{context.hits._index}}* is

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [February 21, 2024, 2:48pm UTC](https://discuss.elastic.co/t/using-the-context-in-body-of-e-mail-for-rules-and-connection/351728/2 "2024-02-21T14:48:32Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
