Text input + plc value to email

#1

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.


change%20node
function

0 Likes

#2

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

var emailText = flow.get("emailText");
msg.payload = emailText + " : counter = " + counter;
0 Likes

#3

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


change%20node
function

0 Likes

#4

In your Function node you appear to have:

var emailText = flow.get

That is not right. It should be:

var emailText = flow.get("emailText");
0 Likes

#5

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

0 Likes

#6

I have it this way but it doesn´t work
function

0 Likes

#7

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?

0 Likes

#8

Thy changing the line to this...

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

See what happens

0 Likes

#9

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?

0 Likes

#10

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.

0 Likes

#11

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

0 Likes

#12

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

1 Like

#13

Excellent.

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

1 Like