# X-Pack Watcher Email Action Formatting Question

**URL:** <https://discuss.elastic.co/t/x-pack-watcher-email-action-formatting-question/185988>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-alerting\
**Created:** [June 17, 2019, 3:55am UTC](https://discuss.elastic.co/t/x-pack-watcher-email-action-formatting-question/185988 "2019-06-17T03:55:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![EricWS](https://avatars.discourse-cdn.com/v4/letter/e/d26b3c/32.png) [@EricWS](https://discuss.elastic.co/u/EricWS)\
**Post date:** [June 17, 2019, 3:55am UTC](https://discuss.elastic.co/t/x-pack-watcher-email-action-formatting-question/185988/1 "2019-06-17T03:55:26Z")

</div>

Hi all,

I have the below watcher set up to email me when a specific condition it met. It emails the results related to what was found in the body of an email.

The problem I have is it sends it as a raw JSON file in the body of the email.

My question is, is there a way to format this nicer, i.e. maybe HTML so it is user friendly content embedded in the email that is sent?

```
{
  "trigger": {
    "schedule": {
      "interval": "30m"
    }
  },
  "input": {
    "search": {
      "request": {
        "search_type": "query_then_fetch",
        "indices": [
          "providence_doc*"
        ],
        "types": [],
        "body": {
          "query": {
            "bool": {
              "must": [
                {
                  "match": {
                    "entity": "Cyber Security Monitoring"
                  }
                },
                {
                  "query_string": {
                    "query": "\"DDoS\" AND \"currently\" OR \"experiencing\"",
                    "analyze_wildcard": true,
                    "default_field": "*"
                  }
                }
              ]
            }
          }
        }
      }
    }
  },
  "condition": {
    "compare": {
      "ctx.payload.hits.total": {
        "gt": 0
      }
    }
  },
  "actions": {
    "send_email": {
      "email": {
        "profile": "standard",
        "to": [
          "name@worldstack.net"
        ],
        "subject": "Current DDoS Attacks",
        "body": {
          "text": "{{#toJson}}ctx.payload{{/toJson}}"
        }
      }
    }
  }
}
```

---

<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:** [July 15, 2019, 4:07am UTC](https://discuss.elastic.co/t/x-pack-watcher-email-action-formatting-question/185988/2 "2019-07-15T04:07:50Z")

</div>

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