# Elasticsearch Rule SMTP Action - How to include line breaks

**URL:** <https://discuss.elastic.co/t/elasticsearch-rule-smtp-action-how-to-include-line-breaks/384900>\
**Category:** Elasticsearch\
**Created:** [February 3, 2026, 8:11pm UTC](https://discuss.elastic.co/t/elasticsearch-rule-smtp-action-how-to-include-line-breaks/384900 "2026-02-03T20:11:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Elk\_huh](https://avatars.discourse-cdn.com/v4/letter/e/d26b3c/32.png) [@Elk\_huh](https://discuss.elastic.co/u/Elk_huh)\
**Post date:** [February 3, 2026, 8:11pm UTC](https://discuss.elastic.co/t/elasticsearch-rule-smtp-action-how-to-include-line-breaks/384900/1 "2026-02-03T20:11:36Z")

</div>

```auto
{{#context.hits}}
Source IP Address: {{_source.src_ip}}
Message {{_source.new_port}}
{{/context.hits}}

```

I need spaces after every context entry , right now its all jammed together

- 

```auto
Source IP Address:
Message
Source IP Address:
Message 
Source IP Address:
Message 
Source IP Address:
Message 
Source IP Address:
Message 
Source IP Address:
Message 

```

and \n doesnt work

---

<div class="post-metadata">

**Author:** ![Tortoise](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tortoise/32/147587_2.png) [@Tortoise](https://discuss.elastic.co/u/Tortoise)\
**Post date:** [February 5, 2026, 6:41am UTC](https://discuss.elastic.co/t/elasticsearch-rule-smtp-action-how-to-include-line-breaks/384900/2 "2026-02-05T06:41:59Z")

</div>

Hello @Elk_huh

Could you please share the ELK version?

On 9.2.0 have tried below format & see it is working :

```auto
{
  "customers_text": "{{#context.hits}}- Customer First Name: {{_source.customer_first_name}}\n Customer Gender: ({{_source.customer_gender}})\n\n{{/context.hits}}",
  "@timestamp": "{{date}}"
}

```

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/e/f/efd301f999182cecb5d6582c06f350fc0f803d8c.png)

Thanks!!

---

<div class="post-metadata">

**Author:** ![Elk\_huh](https://avatars.discourse-cdn.com/v4/letter/e/d26b3c/32.png) [@Elk\_huh](https://discuss.elastic.co/u/Elk_huh)\
**Post date:** [February 5, 2026, 2:05pm UTC](https://discuss.elastic.co/t/elasticsearch-rule-smtp-action-how-to-include-line-breaks/384900/3 "2026-02-05T14:05:38Z")

</div>

8.17 , right now its not interpreting the HTML , once output to email , it shows the \n
