Set email recipient from POST

Hello, i'm able to send email when access "127.0.0.1:1880/hello" or make a GET request with this flow:

[{"id":"b84d8811.9408d8","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"515bb640.bd9fe8","type":"debug","z":"b84d8811.9408d8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":450,"y":180,"wires":[]},{"id":"ec6d8ce8.61ad7","type":"e-mail","z":"b84d8811.9408d8","server":"smtp.gmail.com","port":"465","secure":true,"tls":true,"name":"andre.def93@gmail.com","dname":"","x":500,"y":320,"wires":[]},{"id":"50ac67db.e35b38","type":"http response","z":"b84d8811.9408d8","name":"","statusCode":"","headers":{},"x":670,"y":260,"wires":[]},{"id":"b844e609.5261a8","type":"http in","z":"b84d8811.9408d8","name":"","url":"/hello","method":"get","upload":false,"swaggerDoc":"","x":120,"y":260,"wires":[["515bb640.bd9fe8","ec6d8ce8.61ad7","50ac67db.e35b38"]]}]

Screenshot%20from%202019-03-20%2021-01-48
But actually i need to make a POST that changes the recipient of email... I read that i need to change the msg.to. But i don't know how to make this trough Postman (for example) and if i need to one more msg.to node.

Is a simples question, any help is welcome.

Solved!
Change the flow to:

[{"id":"9d3a191d.f1cf68","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"e8ee7aa6.861908","type":"debug","z":"9d3a191d.f1cf68","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":450,"y":180,"wires":[]},{"id":"97d3c4b4.24f598","type":"e-mail","z":"9d3a191d.f1cf68","server":"smtp.gmail.com","port":"465","secure":true,"tls":true,"name":"","dname":"","x":650,"y":380,"wires":[]},{"id":"8446b5f7.7221f8","type":"http response","z":"9d3a191d.f1cf68","name":"","statusCode":"","headers":{},"x":670,"y":260,"wires":[]},{"id":"b06f5548.43ec78","type":"http in","z":"9d3a191d.f1cf68","name":"","url":"/hello","method":"post","upload":false,"swaggerDoc":"","x":130,"y":260,"wires":[["e8ee7aa6.861908","8446b5f7.7221f8","b8849fa0.281fd"]]},{"id":"b8849fa0.281fd","type":"function","z":"9d3a191d.f1cf68","name":"","func":"msg.to = msg.payload.to\nreturn msg;","outputs":1,"noerr":0,"x":320,"y":400,"wires":[["97d3c4b4.24f598"]]}]

And pass a body from post works good.

1 Like