# Inconsistent newlines in watcher email body text

**URL:** <https://discuss.elastic.co/t/inconsistent-newlines-in-watcher-email-body-text/148668>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-alerting\
**Created:** [September 14, 2018, 6:35pm UTC](https://discuss.elastic.co/t/inconsistent-newlines-in-watcher-email-body-text/148668 "2018-09-14T18:35:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jgburks](https://avatars.discourse-cdn.com/v4/letter/j/c67d28/32.png) [@jgburks](https://discuss.elastic.co/u/jgburks)\
**Post date:** [September 14, 2018, 6:35pm UTC](https://discuss.elastic.co/t/inconsistent-newlines-in-watcher-email-body-text/148668/1 "2018-09-14T18:35:21Z")

</div>

I'm using this Watcher code to send myself emails:

```
    "body": {
      "text": "{{#ctx.payload.hits.hits}}{{_source.@timestamp}} {{_source.message}}\n{{/ctx.payload.hits.hits}}"

```

But I don't get a newline in the email body between hits. But when I add some extra characters around the newline like this:

```
    "body": {
      "text": "{{#ctx.payload.hits.hits}}{{_source.@timestamp}} {{_source.message}} *\n* {{/ctx.payload.hits.hits}}"

```

The newline magically appears between the asterisks. This is the latest ELK stack with Kibana 6.4.

Why is this inconsistent? I just want a simple list of my hits in the email body.

Thanks

---

<div class="post-metadata">

**Author:** ![elastock](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/elastock/32/35672_2.png) [@elastock](https://discuss.elastic.co/u/elastock)\
**Post date:** [September 20, 2018, 8:31am UTC](https://discuss.elastic.co/t/inconsistent-newlines-in-watcher-email-body-text/148668/2 "2018-09-20T08:31:36Z")

</div>

You can change the body to html 🙂  
`"body": { "html": """ <html>...</html>"""}`

Then you will be able to customize emails as much as you want

---

<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:** [September 20, 2018, 11:40am UTC](https://discuss.elastic.co/t/inconsistent-newlines-in-watcher-email-body-text/148668/3 "2018-09-20T11:40:36Z")

</div>

this looks like a duplicate from [Inconsistent newlines in email body text](https://discuss.elastic.co/t/inconsistent-newlines-in-email-body-text/148681/3) - unless I am missing something.

---

<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:** [October 18, 2018, 11:40am UTC](https://discuss.elastic.co/t/inconsistent-newlines-in-watcher-email-body-text/148668/4 "2018-10-18T11:40:59Z")

</div>

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