# Flow context to email node

**URL:** <https://discourse.nodered.org/t/flow-context-to-email-node/43866>\
**Category:** General\
**Created:** [8 April 2021 13:51 UTC](https://discourse.nodered.org/t/flow-context-to-email-node/43866 "2021-04-08T13:51:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![OrluckIndBJ](https://avatars.discourse-cdn.com/v4/letter/o/ecb155/32.png) [@OrluckIndBJ](https://discourse.nodered.org/u/OrluckIndBJ)\
**Post date:** [8 April 2021 13:51 UTC](https://discourse.nodered.org/t/flow-context-to-email-node/43866/1 "2021-04-08T13:51:42Z")

</div>

Another newbie question here. I am using the dashboard to pick a person to send an email notification for their shift. What I am having problems with is getting the email node to take the flow context variable in the "TO" field. I am sure it is a format issue. Also is there a way to see that the flow context variable "flow.name" has been set?

```auto
[{"id":"95ecd5b6.b22878","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"7166e762.1917d8","type":"inject","z":"95ecd5b6.b22878","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"Machinealarm","payloadType":"str","x":150,"y":920,"wires":[["4bd1819d.bd3e3"]]},{"id":"4bd1819d.bd3e3","type":"e-mail","z":"95ecd5b6.b22878","server":"smtp.gmail.com","port":"465","secure":true,"tls":true,"name":"Flow.name","dname":"email node","x":550,"y":920,"wires":[]},{"id":"a888fe04.0706e","type":"debug","z":"95ecd5b6.b22878","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":640,"y":720,"wires":[]},{"id":"1a0517f3.9e2eb8","type":"change","z":"95ecd5b6.b22878","name":"","rules":[{"t":"set","p":"name","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":400,"y":800,"wires":[["a888fe04.0706e"]]},{"id":"b32fa003.90f1c","type":"debug","z":"95ecd5b6.b22878","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":410,"y":700,"wires":[]},{"id":"a9aecc01.5eafc","type":"ui_dropdown","z":"95ecd5b6.b22878","name":"Machinist List on dashboard","label":"","tooltip":"","place":"Select option","group":"626ca449.4dfd8c","order":0,"width":0,"height":0,"passthru":true,"multiple":false,"options":[{"label":"BJ","value":"555444@tmomail.ne","type":"str"},{"label":"BM","value":"5554444@vtext.co","type":"str"}],"payload":"","topic":"","x":120,"y":800,"wires":[["1a0517f3.9e2eb8","b32fa003.90f1c"]]},{"id":"626ca449.4dfd8c","type":"ui_group","name":"Machinist List","tab":"22daeffd.b2613","order":1,"disp":true,"width":"6","collapse":false},{"id":"22daeffd.b2613","type":"ui_tab","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]

```

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [8 April 2021 16:35 UTC](https://discourse.nodered.org/t/flow-context-to-email-node/43866/2 "2021-04-08T16:35:06Z")

</div>

As the info sidebar says... " The default message recipient can be configured in the node, if it is left blank it should be set using the `msg.to` property of the incoming message."  
So you need to use a change node before the email node to move `flow.name` to `msg.to`  
(and leave the To field bank in the email node)

---

<div class="post-metadata">

**Author:** ![OrluckIndBJ](https://avatars.discourse-cdn.com/v4/letter/o/ecb155/32.png) [@OrluckIndBJ](https://discourse.nodered.org/u/OrluckIndBJ)\
**Post date:** [8 April 2021 17:55 UTC](https://discourse.nodered.org/t/flow-context-to-email-node/43866/3 "2021-04-08T17:55:57Z")

</div>

That works great! Thank you.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [22 April 2021 17:56 UTC](https://discourse.nodered.org/t/flow-context-to-email-node/43866/4 "2021-04-22T17:56:28Z")

</div>

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