# Text input + plc value to email

**URL:** <https://discourse.nodered.org/t/text-input-plc-value-to-email/9647>\
**Category:** Dashboard\
**Created:** [1 April 2019 06:28 UTC](https://discourse.nodered.org/t/text-input-plc-value-to-email/9647 "2019-04-01T06:28:26Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![JokinSegu](https://avatars.discourse-cdn.com/v4/letter/j/ed655f/32.png) [@JokinSegu](https://discourse.nodered.org/u/JokinSegu)\
**Post date:** [1 April 2019 06:28 UTC](https://discourse.nodered.org/t/text-input-plc-value-to-email/9647/1 "2019-04-01T06:28:26Z")

</div>

I am trying to write the text to send to the email from the ui dashboard, I get to do it with an static text, but now I need to write te text from the ui.  
How can I do it? This are nodes for the email notification.

 ![msg%20input](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/1/1f70a704f3113385b5546c4cf731cba2a3b55061.png)  
 ![change%20node](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/3/37c34a61c6e8ae8d36465c2a02287dd2662652c0.png)  
 ![function](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/9/993035246aec636fc0ce743e0b9dd70054bedd4f.png)

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [1 April 2019 07:16 UTC](https://discourse.nodered.org/t/text-input-plc-value-to-email/9647/2 "2019-04-01T07:16:06Z")

</div>

Try feeding a ui-text node to a change node that sets flow.emailText (i.e. store the text input in a flow variable - just like you did for email address)

Then in your function, use

```auto
var emailText = flow.get("emailText");
msg.payload = emailText + " : counter = " + counter;

```

---

<div class="post-metadata">

**Author:** ![JokinSegu](https://avatars.discourse-cdn.com/v4/letter/j/ed655f/32.png) [@JokinSegu](https://discourse.nodered.org/u/JokinSegu)\
**Post date:** [1 April 2019 07:37 UTC](https://discourse.nodered.org/t/text-input-plc-value-to-email/9647/3 "2019-04-01T07:37:41Z")

</div>

and the change node I don´t need to connect it??  
I send you here how does it looks now, is it okey?

 ![msg%20input](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/8/8338ac602e6a82317af449ea530f692bea035809.png)  
 ![change%20node](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/e/ee40a81d15152a493feece84714cfa7f92359b3b.png)  
 ![function](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/4/4d7fd746ddf0e3b4a55e567ad3b3e99fd3104a35.png)

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [1 April 2019 07:39 UTC](https://discourse.nodered.org/t/text-input-plc-value-to-email/9647/4 "2019-04-01T07:39:58Z")

</div>

In your Function node you appear to have:

```auto
var emailText = flow.get

```

That is not right. It should be:

```auto
var emailText = flow.get("emailText");

```

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [1 April 2019 07:41 UTC](https://discourse.nodered.org/t/text-input-plc-value-to-email/9647/5 "2019-04-01T07:41:36Z")

</div>

> [@JokinSegu](#):
>
> and the change node I don´t need to connect it??  
> I send you here how does it looks now, is it okey?

Almost.

You didn't finish the code in the function node.

Write the full line...  
`var emailText = flow.get("emailText")`

I get the feeling you need to learn JavaScript. It will help you immensely.

Good luck

---

<div class="post-metadata">

**Author:** ![JokinSegu](https://avatars.discourse-cdn.com/v4/letter/j/ed655f/32.png) [@JokinSegu](https://discourse.nodered.org/u/JokinSegu)\
**Post date:** [1 April 2019 07:47 UTC](https://discourse.nodered.org/t/text-input-plc-value-to-email/9647/6 "2019-04-01T07:47:38Z")

</div>

I have it this way but it doesn´t work  
 ![function](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/b/b52197eaadbc6ea25eadee1303b41b1a418629a2.png)

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [1 April 2019 07:49 UTC](https://discourse.nodered.org/t/text-input-plc-value-to-email/9647/7 "2019-04-01T07:49:17Z")

</div>

Hi - what doesn't work about it?

What does the Debug node you have next to the Email node tell you about the message you are trying to send?

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [1 April 2019 07:52 UTC](https://discourse.nodered.org/t/text-input-plc-value-to-email/9647/8 "2019-04-01T07:52:35Z")

</div>

Thy changing the line to this...

`var emailText = flow.get("emailText") || " INFO: email text not set!";`

See what happens

---

<div class="post-metadata">

**Author:** ![JokinSegu](https://avatars.discourse-cdn.com/v4/letter/j/ed655f/32.png) [@JokinSegu](https://discourse.nodered.org/u/JokinSegu)\
**Post date:** [1 April 2019 07:56 UTC](https://discourse.nodered.org/t/text-input-plc-value-to-email/9647/9 "2019-04-01T07:56:27Z")

</div>

okey now it working thank you two, and I am sending this email per day and I want to send the email with the value could I do it?

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [1 April 2019 07:58 UTC](https://discourse.nodered.org/t/text-input-plc-value-to-email/9647/10 "2019-04-01T07:58:43Z")

</div>

You're welcome.  
As for your new requirement, the answer is "of course you can" however please use what you have learned and try for your self first. When you get stuck, ask for help.

Good luck.

---

<div class="post-metadata">

**Author:** ![JokinSegu](https://avatars.discourse-cdn.com/v4/letter/j/ed655f/32.png) [@JokinSegu](https://discourse.nodered.org/u/JokinSegu)\
**Post date:** [1 April 2019 08:01 UTC](https://discourse.nodered.org/t/text-input-plc-value-to-email/9647/11 "2019-04-01T08:01:35Z")

</div>

yes sure thank you I am trying it already i will let you know about any news

---

<div class="post-metadata">

**Author:** ![JokinSegu](https://avatars.discourse-cdn.com/v4/letter/j/ed655f/32.png) [@JokinSegu](https://discourse.nodered.org/u/JokinSegu)\
**Post date:** [1 April 2019 08:09 UTC](https://discourse.nodered.org/t/text-input-plc-value-to-email/9647/12 "2019-04-01T08:09:45Z")

</div>

Thank you for your help I think I learn more about Node-Red, and I get it without problems now it is working perfectly

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [1 April 2019 08:11 UTC](https://discourse.nodered.org/t/text-input-plc-value-to-email/9647/13 "2019-04-01T08:11:43Z")

</div>

Excellent.

As we say in UK, "the penny has dropped"

---

<div class="post-metadata">

**Author:** ![thanhbinh](https://avatars.discourse-cdn.com/v4/letter/t/e274bd/32.png) [@thanhbinh](https://discourse.nodered.org/u/thanhbinh)\
**Post date:** [15 June 2022 13:54 UTC](https://discourse.nodered.org/t/text-input-plc-value-to-email/9647/14 "2022-06-15T13:54:33Z")

</div>

Hi, I have a problem. When I just have an IF to send an alarm to announce for Email. But when I observe my email, I see email announce continuity for me (include if condition and no if).  
How I do overcome it?. Please.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [15 June 2022 13:57 UTC](https://discourse.nodered.org/t/text-input-plc-value-to-email/9647/15 "2022-06-15T13:57:06Z")

</div>

> [@thanhbinh](#):
>
> How I do overcome it?. Please.

Impossible to tell without any detail but it is most likely your `if` test is not doing what you think it is doing!

As this thread is unrelated and over 3 years old, I am going to close it and ask that you start a new thread with all the relevant details (like your flow, debug values etc)

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [15 June 2022 13:57 UTC](https://discourse.nodered.org/t/text-input-plc-value-to-email/9647/16 "2022-06-15T13:57:11Z")

</div>


