Set the gmail address from the dashboard

#1

Is it possible to change the gmail addredd from the dashboard with an text input and to send the input to that gmail that we write??

#2

Yes, the readme for the Email node contains the details of how to set the to email address within the message object.

#3

email%20input e-mail%20node


I have this way and I read the readme but I don´t get it, can you tell me what do I need to write

#4

The node help says this:

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.

That does not mean you type msg.to into edit dialog for the node. It says to leave that field blank, and it will then use whatever value you provide in the msg.to property of the messages it receives.

#5

so if I just take out the msg.to from the email node is it enaugh?

#6

which node do I need to use between both? To send into a msg.to

#7

Take a look at the "Move a message property" flow in the cookbook https://cookbook.nodered.org.

I also notice that you have two wires going into the Email node.
Each normal node reacts when it receives a message. They don't know to wait until they get additional information in a different message. So you will also need to look at JOINing the two messages together (again the cookbook contains an example)

#8

Sory I don´t get it...


This is the full node. I am sending to telegram and e-mail the static text and the value that I am getting per 10 seconds but I want to change the email adress from the dashboard and it doesn´t work. Do you have any example of something similar because I don´t ge it with the documents of node-red I am new at Node-red and I need help please,

#9

Please tell me you aren't trying to send an Email every 10 seconds?

#10

Hi @JokinSegu

no problem - it can sometimes take a couple goes to 'get' the node-red way of creating flows.

You have your top flow generating the message to send every 10 seconds. By the time that message reaches the email node it needs to have msg.to set to something.

You then have the flow from the email address dashboard node that is triggered when the user provides an email address.

In this case, the Join node isn't the right way to join those two together. Here is what I would do...

After the [valor contador] function node, add a Change node configured to set msg.to to the value of flow.email.
After the email address dashboard node have a Change node configured to set flow.email to the value of msg.payload - and don't wire the output of that node to anything else.

So whenever the user provides a new email address, it will update the value stored in flow context. Then, when a new message comes from the top flow, it will pickup that latest email value from flow context.

Some more observations to consider:

  • sending an email every 10 seconds sounds a bit excessive... email isn't normally used for realtime events!
  • consider if you need to try to validate the email address provided - you could add a Function node between the email address and change nodes in order to check the value is sensible.
  • an email every 10 seconds?
#11

no is just to check if it works or not after put it working I will send a message per day to see how many pieces have we done

1 Like
#12

Okey thank you for your help I have done this changes I don´t know if it is right as you tell me.
change1 change2

function

#13

So your dashboard sets a context variable called flow.email

Your move screenimage should say move flow.email to msg.to as it moves that context variable to msg.to which is where the email nodes wants the address

#14

move
this way?

#15

I would recommend using set rather than move - because you want to leave the value in flow context. And if you use set, then the first input is the target value and the second input is where it gets the value from.

#16

I am receiving in the telegram without problem but don´t get any email... I send you everything step by step.


delay
function
email
email%20node
email%20input
to

#17

Which Change node is that last screenshot? If it is the Change node connected to the email address node, then it is not properly configured. The message coming out of the email address dashboard node will have the value in msg.payload. So your Change node should be setting flow.email to the value of msg.payload.

#18

You could also put a debug node onto teh change node before the email node, set it to "output complete message object" and check that all the information is there

#19

change
this way?

#20

Yes - and as @ukmoose suggests, add a Debug node set to display the complete message object next to the Email node so you can see what exactly you are passing in.