# How to enchance the body text in email actions while using watcher in elasticsearch

**URL:** <https://discuss.elastic.co/t/how-to-enchance-the-body-text-in-email-actions-while-using-watcher-in-elasticsearch/180350>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-alerting\
**Created:** [May 9, 2019, 11:45am UTC](https://discuss.elastic.co/t/how-to-enchance-the-body-text-in-email-actions-while-using-watcher-in-elasticsearch/180350 "2019-05-09T11:45:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vishnu\_mk](https://avatars.discourse-cdn.com/v4/letter/v/71c47a/32.png) [@Vishnu\_mk](https://discuss.elastic.co/u/Vishnu_mk)\
**Post date:** [May 9, 2019, 11:45am UTC](https://discuss.elastic.co/t/how-to-enchance-the-body-text-in-email-actions-while-using-watcher-in-elasticsearch/180350/1 "2019-05-09T11:45:19Z")

</div>

This is my action part of my watcher:  
"actions" : {  
"email\_admin" : {  
"email" : {  
"to" : "vishnumk@company.com",  
"subject" : "Priority : High State : Down ",  
"body": {  
"text": "Portal\_URL:{{#ctx.payload.hits.hits}} {{\_source.http.url}} {{/ctx.payload.hits.hits}} Time:{{#ctx.payload.hits.hits}} {{\_source.@timestamp}} {{/ctx.payload.hits.hits}} Error:{{#ctx.payload.hits.hits}} {{\_source.error.message}} {{/ctx.payload.hits.hits}}"  
}  
}  
}  
}

Im getting email as follows  
Portal\_URL: [http://172.24.12.124:9204](http://172.24.12.124:9204) Time: 2019-05-09T09:28:51.090Z Error: 401 Unauthorized

But i want email in below format:

Portal\_URL: [http://172.24.12.124:9204](http://172.24.12.124:9204)  
Time: 2019-05-09T09:28:51.090Z  
Error: 401 Unauthorized

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [May 9, 2019, 12:00pm UTC](https://discuss.elastic.co/t/how-to-enchance-the-body-text-in-email-actions-while-using-watcher-in-elasticsearch/180350/2 "2019-05-09T12:00:17Z")

</div>

try adding newlines using `\n`

--Alex

---

<div class="post-metadata">

**Author:** ![Vishnu\_mk](https://avatars.discourse-cdn.com/v4/letter/v/71c47a/32.png) [@Vishnu\_mk](https://discuss.elastic.co/u/Vishnu_mk)\
**Post date:** [May 10, 2019, 5:26am UTC](https://discuss.elastic.co/t/how-to-enchance-the-body-text-in-email-actions-while-using-watcher-in-elasticsearch/180350/3 "2019-05-10T05:26:08Z")

</div>

Thank You:smile:

---

<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:** [June 7, 2019, 5:26am UTC](https://discuss.elastic.co/t/how-to-enchance-the-body-text-in-email-actions-while-using-watcher-in-elasticsearch/180350/4 "2019-06-07T05:26:15Z")

</div>

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