Load email address from dashboard

Hi All
I'm trying to load an email address from dashboard to my email node
When I try trigger the email, the trigger replaces the email address causing an error
Any suggestions would be appreciated.
Regards
Barry

Want to provide a small sample flow demonstrating the issue?

[{"id":"a05fc519.e36ad8","type":"inject","z":"716e078a.2ee618","name":"","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":90,"y":220,"wires":[["6254b2a6.e92fec","74adbc63.ec9b34"]]},{"id":"6254b2a6.e92fec","type":"ui_text_input","z":"716e078a.2ee618","name":"","label":"Email","group":"9ab3fb8d.b50348","order":0,"width":0,"height":0,"passthru":false,"mode":"email","delay":300,"topic":"","x":270,"y":200,"wires":[["368e8207.edbe3e"]]},{"id":"74adbc63.ec9b34","type":"file in","z":"716e078a.2ee618","name":"Batch Reports","filename":"/home/pi/node-red/Batch Requested Temp.csv","format":"","chunk":false,"sendError":false,"x":260,"y":260,"wires":[["93b7bbcf.f7dcc8"]]},{"id":"368e8207.edbe3e","type":"change","z":"716e078a.2ee618","name":"","rules":[{"t":"set","p":"to","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":450,"y":200,"wires":[["a08040a9.9206a","6d603ab0.de65a4"]]},{"id":"93b7bbcf.f7dcc8","type":"change","z":"716e078a.2ee618","name":"","rules":[{"t":"set","p":"attachments","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":480,"y":260,"wires":[["a08040a9.9206a"]]},{"id":"a08040a9.9206a","type":"e-mail","z":"716e078a.2ee618","server":"smtp.gmail.com","port":"465","secure":true,"name":"","dname":"UI Email","x":680,"y":200,"wires":[]},{"id":"6d603ab0.de65a4","type":"debug","z":"716e078a.2ee618","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":590,"y":120,"wires":[]},{"id":"9ab3fb8d.b50348","type":"ui_group","z":"","name":"Default","tab":"3cf93c06.c8b134","disp":true,"width":"6","collapse":false},{"id":"3cf93c06.c8b134","type":"ui_tab","z":"","name":"Home","icon":"dashboard"}]

Ok, first off the ui-text will send the payload as each letter is typed, so if you were typing in barry@mydomain.com, then you would get
b
ba
bar
barr
barry
barry@
... till
barry@mydomain.com
and it would try to send it for each payload.

Try using the ui-form and pick the type E-mail

Hi & thank you

[{"id":"a05fc519.e36ad8","type":"inject","z":"716e078a.2ee618","name":"","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":200,"wires":[["74adbc63.ec9b34","368e8207.edbe3e"]]},{"id":"74adbc63.ec9b34","type":"file in","z":"716e078a.2ee618","name":"Batch Reports","filename":"/home/pi/node-red/Batch Requested Temp.csv","format":"","chunk":false,"sendError":false,"x":280,"y":260,"wires":[["93b7bbcf.f7dcc8"]]},{"id":"368e8207.edbe3e","type":"change","z":"716e078a.2ee618","name":"","rules":[{"t":"set","p":"to","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":450,"y":200,"wires":[["a08040a9.9206a","6d603ab0.de65a4"]]},{"id":"93b7bbcf.f7dcc8","type":"change","z":"716e078a.2ee618","name":"","rules":[{"t":"set","p":"attachments","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":480,"y":260,"wires":[["a08040a9.9206a"]]},{"id":"a08040a9.9206a","type":"e-mail","z":"716e078a.2ee618","server":"smtp.gmail.com","port":"465","secure":true,"name":"","dname":"UI Email","x":680,"y":200,"wires":[]},{"id":"6d603ab0.de65a4","type":"debug","z":"716e078a.2ee618","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":590,"y":120,"wires":[]},{"id":"998ca6b.a666c58","type":"ui_form","z":"716e078a.2ee618","name":"","label":"","group":"9ab3fb8d.b50348","order":0,"width":0,"height":0,"options":[{"label":"","value":"E-mail","type":"email","required":true}],"formValue":{"E-mail":""},"payload":"","topic":"","x":260,"y":120,"wires":[["368e8207.edbe3e"]]},{"id":"9ab3fb8d.b50348","type":"ui_group","z":"","name":"Default","tab":"3cf93c06.c8b134","disp":true,"width":"6","collapse":false},{"id":"3cf93c06.c8b134","type":"ui_tab","z":"","name":"Home","icon":"dashboard"}]

But it still wont trigger.

stick a debug node to the output of the form (complete msg object) and see what comes out.

7‎/‎12‎/‎2018‎ ‎11‎:‎38‎:‎35‎ ‎AMnode: 462ac887.5d0c48

msg : Object

object

payload: object

E-mail: "barry@mydomane.com"

topic: ""

socketid: "uSxIPahPpABpYhzeAAAB"

_msgid: "43d99ba8.073404"

ok, so the email address is in msg.payload.E-mail... What is your change node doing?

the purpose of the change node is to change the payload to msg.to for the email node

You need to move the piece of the msg that contains the email address to msg.to

So what now contains the email address?

is move a node or a function of the change node ?

move moves a chunk of data from one place to another
set copies a chunk of data from one place to another

use which ever fits the issue you are dealing with

[{"id":"a05fc519.e36ad8","type":"inject","z":"716e078a.2ee618","name":"","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":200,"wires":[["74adbc63.ec9b34"]]},{"id":"74adbc63.ec9b34","type":"file in","z":"716e078a.2ee618","name":"Batch Reports","filename":"/home/pi/node-red/Batch Requested Temp.csv","format":"","chunk":false,"sendError":false,"x":280,"y":260,"wires":[["93b7bbcf.f7dcc8"]]},{"id":"93b7bbcf.f7dcc8","type":"change","z":"716e078a.2ee618","name":"","rules":[{"t":"set","p":"attachments","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":480,"y":260,"wires":[["a08040a9.9206a"]]},{"id":"a08040a9.9206a","type":"e-mail","z":"716e078a.2ee618","server":"smtp.gmail.com","port":"465","secure":true,"name":"","dname":"UI Email","x":680,"y":200,"wires":[]},{"id":"368e8207.edbe3e","type":"change","z":"716e078a.2ee618","name":"","rules":[{"t":"move","p":"to","pt":"msg","to":"msg.to","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":490,"y":200,"wires":[["a08040a9.9206a","6d603ab0.de65a4"]]},{"id":"6d603ab0.de65a4","type":"debug","z":"716e078a.2ee618","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":590,"y":120,"wires":[]},{"id":"998ca6b.a666c58","type":"ui_form","z":"716e078a.2ee618","name":"","label":"","group":"9ab3fb8d.b50348","order":0,"width":0,"height":0,"options":[{"label":"Contact 1","value":"msg.to","type":"email","required":true}],"formValue":{"msg.to":""},"payload":"","topic":"","x":260,"y":120,"wires":[["462ac887.5d0c48","368e8207.edbe3e"]]},{"id":"462ac887.5d0c48","type":"debug","z":"716e078a.2ee618","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":600,"y":40,"wires":[]},{"id":"9ab3fb8d.b50348","type":"ui_group","z":"","name":"Default","tab":"3cf93c06.c8b134","disp":true,"width":"6","collapse":false},{"id":"3cf93c06.c8b134","type":"ui_tab","z":"","name":"Home","icon":"dashboard"}]]

I can't see what i'm doing wrong

your change node says:
Move: msg.to
to : msg.msg.to
which says move what ever is in msg.to to the field msg.msg.to.

  1. where did you come up with msg.msg.to
  2. look at the email node - what field do you need to pass to it?
  3. go back and look at the debug node output from the ui-form node - what field contains the email address?

So, now that you have that information, how should you setup your change node?

(I gave you the answer to part of this several posts ago)

1 Like

Thank You Paul :sunglasses::sunglasses::sunglasses:

I'm glad I could point you in the direction so you could figure it out yourself. :grinning:

I can load the email address into the email node
and it sends an e-mail

But when I trigger the email from a different source , the address is gone and I get a

"Error: No recipients defined"
Is it possible to have the address remain as default

can you be more specific about a 'different source'? Maybe attach the flow?

[{"id":"95f0485e.98aa58","type":"inject","z":"716e078a.2ee618","name":"","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":270,"y":140,"wires":[["739d84ba.594f7c"]]},{"id":"739d84ba.594f7c","type":"file in","z":"716e078a.2ee618","name":"Batch Reports","filename":"/home/pi/node-red/Batch Requested Temp.csv","format":"","chunk":false,"sendError":false,"x":480,"y":140,"wires":[["9278b0f0.474f1"]]},{"id":"9278b0f0.474f1","type":"e-mail","z":"716e078a.2ee618","server":"smtp.gmail.com","port":"465","secure":true,"name":"","dname":"","x":750,"y":140,"wires":[]},{"id":"7ec48af5.b81ff4","type":"change","z":"716e078a.2ee618","name":"","rules":[{"t":"set","p":"to","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":570,"y":40,"wires":[["bc9ed8ca.efae88","9278b0f0.474f1"]]},{"id":"29a21c74.681074","type":"inject","z":"716e078a.2ee618","name":"","topic":"email","payload":"barry.miller@live.com","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":340,"y":40,"wires":[["7ec48af5.b81ff4"]]},{"id":"bc9ed8ca.efae88","type":"debug","z":"716e078a.2ee618","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":750,"y":40,"wires":[]}]

The email node does not remember the address etc from the previous email, each message you send has to have that data, so you need to set it in the message being passed from the File node. You can insert a Change node to do that.