# Elastic Mail Watcher escape html in logs

**URL:** <https://discuss.elastic.co/t/elastic-mail-watcher-escape-html-in-logs/266374>\
**Category:** Kibana\
**Created:** [March 5, 2021, 1:11pm UTC](https://discuss.elastic.co/t/elastic-mail-watcher-escape-html-in-logs/266374 "2021-03-05T13:11:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rLenhard](https://avatars.discourse-cdn.com/v4/letter/r/e5b9ba/32.png) [@rLenhard](https://discuss.elastic.co/u/rLenhard)\
**Post date:** [March 5, 2021, 1:11pm UTC](https://discuss.elastic.co/t/elastic-mail-watcher-escape-html-in-logs/266374/1 "2021-03-05T13:11:41Z")

</div>

Hi,

I created an email watcher witch html-body. Some of the logs I am returning with ctx.payload.hits.hits have html tags in their value:  
Is there a way to escape the return so the tags in the value are displayed as tags in the mail?  
logValue: "someDetailAboutHTML \*"  
Thanks vor helping.

---

<div class="post-metadata">

**Author:** ![tsullivan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tsullivan/32/31077_2.png) [@tsullivan](https://discuss.elastic.co/u/tsullivan)\
**Post date:** [March 17, 2021, 1:35am UTC](https://discuss.elastic.co/t/elastic-mail-watcher-escape-html-in-logs/266374/2 "2021-03-17T01:35:40Z")

</div>

Hi, if you are using the "email action" you should check out the documented attributes:

> **[Watcher email action | Elasticsearch Guide \[8.11\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/actions-email.html#email-action-attributes)**

> `body` : The body of the email. When this field holds a string, it will default to the text body of the email. Set as an object to specify either the text or the html body or both (using the fields below

> `body.text` : The plain text body of the email. The body can be static text or contain Mustache [templates](https://www.elastic.co/guide/en/elasticsearch/reference/current/how-watcher-works.html#templates).

> `body.html` : The html body of the email. The body can be static text or contain Mustache [templates](https://www.elastic.co/guide/en/elasticsearch/reference/current/how-watcher-works.html#templates). This body will be sanitized to remove dangerous content such as scripts. This behavior can be disabled by setting `xpack.notification.email.html.sanitization.enabled: false` in `elasticsearch.yaml` .

If you are using `body`, you can try using `body.text`

---

<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:** [April 14, 2021, 1:36am UTC](https://discuss.elastic.co/t/elastic-mail-watcher-escape-html-in-logs/266374/3 "2021-04-14T01:36:28Z")

</div>

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