# Notification use custom mail

**URL:** <https://community.graylog.org/t/notification-use-custom-mail/19602>\
**Category:** Graylog Central (peer support)\
**Created:** [April 26, 2021, 8:09am UTC](https://community.graylog.org/t/notification-use-custom-mail/19602 "2021-04-26T08:09:34Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Teo](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Teo](https://community.graylog.org/u/Teo)\
**Post date:** [April 26, 2021, 8:09am UTC](https://community.graylog.org/t/notification-use-custom-mail/19602/1 "2021-04-26T08:09:34Z")

</div>

Hi  
In the notifications I would like to use a variable to change the email recipient.

I need to alert a user when an event occurs, so I retrieve the email address via a lookup table and save it in an Event Fields.  
how can i use the email contained in the Event Fields in email recipient?

Thanks for your help

---

<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:** [April 30, 2021, 1:22am UTC](https://community.graylog.org/t/notification-use-custom-mail/19602/2 "2021-04-30T01:22:14Z")

</div>

Hello,

> [@Teo](#):
>
> In the notifications I would like to use a variable to change the email recipient.

You refering to this?

 ![image](https://us1.discourse-cdn.com/flex016/uploads/graylog/original/2X/b/befb574a6c3abb1545cd135ee06877733651d770.png)

What version of Graylog are you using?

> [@Teo](#):
>
> I need to alert a user when an event occurs, so I retrieve the email address via a lookup table and save it in an Event Fields.

Could you explain in greater detail on this?

> [@Teo](#):
>
> how can i use the email contained in the Event Fields in email recipient?

Are you refering to Notification Template?

---

<div class="post-metadata">

**Author:** ![Teo](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Teo](https://community.graylog.org/u/Teo)\
**Post date:** [May 3, 2021, 4:02pm UTC](https://community.graylog.org/t/notification-use-custom-mail/19602/3 "2021-05-03T16:02:56Z")

</div>

Hello,  
thanks for your reply.

> [@Teo](#):
>
> In the notifications I would like to use a variable to change the email recipient.

You refering to this?  
Yes, It’s true  
 ![01](https://us1.discourse-cdn.com/flex016/uploads/graylog/original/2X/f/f6c5e482df1857bed93ba1052e51df1acad0be45.png)

What version of Graylog are you using?  
The graylog version is 4.0.6.

> [@Teo](#):
>
> I need to alert a user when an event occurs, so I retrieve the email address via a lookup table and save it in an Event Fields.

Could you explain in greater detail on this?

I would like to send an email when the user logs into the vpn. Through a lookup table I retrieve the email of the specific user and I would like to use it as the recipient of the email.  
I tried setting the email as a key field but I can’t specify it as the recipient of the notification.

 ![02](https://us1.discourse-cdn.com/flex016/uploads/graylog/original/2X/f/fc57950f7c60a1ac41742ecb6c636df62577d34f.png)

Thanks  
Matteo

---

<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:** [May 3, 2021, 10:48pm UTC](https://community.graylog.org/t/notification-use-custom-mail/19602/4 "2021-05-03T22:48:01Z")

</div>

Hello,

> [@Teo](#):
>
> I retrieve the email of the specific user and I would like to use it as the recipient of the email.

The only way I know how to do this is shown below in red box.  
User recipient(s) (Optional) this normally shows all user that is in Graylog User and Teams section.  
Email recipient(s) (Optional) This normally is for someone that is not configuraed in Graylog.

 ![image](https://us1.discourse-cdn.com/flex016/uploads/graylog/original/2X/2/26443003a025ad164fa8bd4411fef8ae366793d2.png)

As for **${event.key}** dont think you can use that for a Email recipients. Maybe someone else here has done that, but Im not familiar with it.

[https://docs.graylog.org/en/4.0/pages/alerts.html#email-alert-notification](https://docs.graylog.org/en/4.0/pages/alerts.html#email-alert-notification)

Hope that helps.

---

<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:** [May 17, 2021, 10:48pm UTC](https://community.graylog.org/t/notification-use-custom-mail/19602/5 "2021-05-17T22:48:21Z")

</div>

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