# Dynamic Mail send

**URL:** https://community.graylog.org/t/dynamic-mail-send/20735
**Category:** Graylog Tech Challenges
**Created:** [August 2, 2021, 1:47pm UTC](https://community.graylog.org/t/dynamic-mail-send/20735 "2021-08-02T13:47:22Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![coffee\_is\_life1337](https://sea2.discourse-cdn.com/flex016/user_avatar/community.graylog.org/coffee_is_life1337/32/9222_2.png) [@coffee\_is\_life1337](https://community.graylog.org/u/coffee_is_life1337)
#### Post date: [August 2, 2021, 1:47pm UTC](https://community.graylog.org/t/dynamic-mail-send/20735/1 "2021-08-02T13:47:22Z")

</div>

Hello Forum,

i want to create dynamic mail notification.  
The aggregation and query is all set.  
The Mail-Template is set aswell and is working great.  
But the problem is:  
I need to use an email from the message(backlog) for the notification receiver  
In Subject i can use the backlog-message and create a dynamic subject based on fields in message.  
i need to use the same procedure for the notification receiver.

anyone who has accomplished that?,

best regards,  
coffee\_is\_life1337

---

<div class="post-metadata">

### Author: ![gsmith](https://sea2.discourse-cdn.com/flex016/user_avatar/community.graylog.org/gsmith/32/1222_2.png) [@gsmith](https://community.graylog.org/u/gsmith)
#### Post date: [August 4, 2021, 12:01am UTC](https://community.graylog.org/t/dynamic-mail-send/20735/2 "2021-08-04T00:01:07Z")

</div>

Hello,

> [@coffee\_is\_life1337](#):
>
> I need to use an email from the message(backlog) for the notification receiver  
> In Subject

Is this similar to what you wanted to do?

> [@Add the value of a backlog message field to Graylog email alert notification subject](https://community.graylog.org/t/add-the-value-of-a-backlog-message-field-to-graylog-email-alert-notification-subject/20693/3):
>
> Hi @gsmith Thanks for your answer. You are saying to do something like this? The problem is that, even with that, Graylog don’t add the additional part of the title (the aggregation) to the subject of the email: The only thing that I can think of to put the value of a field in the subject of an email, is to use the HTTP Notification on Graylog, and make a webhook to get the information of the alert with and automation tool, and send the email with that, but I think that…

---

<div class="post-metadata">

### Author: ![coffee\_is\_life1337](https://sea2.discourse-cdn.com/flex016/user_avatar/community.graylog.org/coffee_is_life1337/32/9222_2.png) [@coffee\_is\_life1337](https://community.graylog.org/u/coffee_is_life1337)
#### Post date: [August 4, 2021, 11:35am UTC](https://community.graylog.org/t/dynamic-mail-send/20735/3 "2021-08-04T11:35:36Z")

</div>

Hi @gsmith,

i used the backlog message in “Subject” successfully.  
now i want to use a value from backlog as “mail recipient” from a notification.

---

<div class="post-metadata">

### Author: ![aguida79](https://avatars.discourse-cdn.com/v4/letter/a/eb8c5e/32.png) [@aguida79](https://community.graylog.org/u/aguida79)
#### Post date: [August 9, 2021, 12:08am UTC](https://community.graylog.org/t/dynamic-mail-send/20735/4 "2021-08-09T00:08:33Z")

</div>

Hi @coffee_is_life1337. Con you explain how you succesfully used the backlog message in “Subject” of an email alert?

Thanks in advance.

---

<div class="post-metadata">

### Author: ![coffee\_is\_life1337](https://sea2.discourse-cdn.com/flex016/user_avatar/community.graylog.org/coffee_is_life1337/32/9222_2.png) [@coffee\_is\_life1337](https://community.graylog.org/u/coffee_is_life1337)
#### Post date: [August 9, 2021, 6:51am UTC](https://community.graylog.org/t/dynamic-mail-send/20735/5 "2021-08-09T06:51:56Z")

</div>

Hello @aguida79,

you need to “open” the backlog message like you do in the message-field:  
Subject: Testsubject for ${foreach backlog message}${message.fields.\<field\_you\_want\_to\_use\>}${end}

this should do it

//EDIT: make sure, you activate the Backlog-message in the alert-configuration:

 ![grafik](https://us1.discourse-cdn.com/flex016/uploads/graylog/original/2X/1/1c4c730a204792366d7cab5c0d521e65b7f4cf8a.png)

best regards,  
coffee\_is\_life1337

---

<div class="post-metadata">

### Author: ![aguida79](https://avatars.discourse-cdn.com/v4/letter/a/eb8c5e/32.png) [@aguida79](https://community.graylog.org/u/aguida79)
#### Post date: [August 10, 2021, 1:42am UTC](https://community.graylog.org/t/dynamic-mail-send/20735/6 "2021-08-10T01:42:49Z")

</div>

Thanks @coffee_is_life1337 ! It worked!

 ![imagen](https://us1.discourse-cdn.com/flex016/uploads/graylog/original/2X/a/aa2be57679e9d6f134f9223b8282cac7bf62ffb8.png)

Regards,  
Alejandro

---

<div class="post-metadata">

### Author: ![aguida79](https://avatars.discourse-cdn.com/v4/letter/a/eb8c5e/32.png) [@aguida79](https://community.graylog.org/u/aguida79)
#### Post date: [August 10, 2021, 2:10am UTC](https://community.graylog.org/t/dynamic-mail-send/20735/7 "2021-08-10T02:10:25Z")

</div>

It worked for the Email Subject, but not for the Alert Title, 😢

 ![imagen](https://us1.discourse-cdn.com/flex016/uploads/graylog/original/2X/0/03921b77d0d5d95f4724f8d92acacf531c0fd89a.png)

 ![imagen](https://us1.discourse-cdn.com/flex016/uploads/graylog/original/2X/a/a331a1e629632d6bd68e709267baf8d127115ae4.png)

For Alert Title, it only works when you make an Aggragation of 1, but the Alert Title with the “count” looks horrible:

 ![imagen](https://us1.discourse-cdn.com/flex016/uploads/graylog/original/2X/a/ad1c85f9a689fadf4f6a9a481769992db0950305.png)

Regards,  
Alejandro

---

<div class="post-metadata">

### Author: ![gsmith](https://sea2.discourse-cdn.com/flex016/user_avatar/community.graylog.org/gsmith/32/1222_2.png) [@gsmith](https://community.graylog.org/u/gsmith)
#### Post date: [August 10, 2021, 2:12am UTC](https://community.graylog.org/t/dynamic-mail-send/20735/8 "2021-08-10T02:12:38Z")

</div>

@coffee_is_life1337

Thanks for sharing. This also worked for us 🙂

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex016/uploads/graylog/original/3X/c/7/c7c09c6b5099570133d6502b83f50ba4430de5b6.png) [@system](https://community.graylog.org/u/system)
#### Post date: [August 24, 2021, 2:12am UTC](https://community.graylog.org/t/dynamic-mail-send/20735/9 "2021-08-24T02:12:54Z")

</div>

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