Node-Red Sending Unencoded text or filenames over email Instead of photos

I've automated taking and storing photos with camerapi, I've automated the sending of emails, but I'm not certain how to Send camerapi photos over email.

Trying to follow this guide but not sure how to employ JSONata in my flow (See "Bart's" solution):
https://groups.google.com/forum/#!topic/node-red/tvWErCxIFdA

Here is my flow:

[{"id":"2fa4e827.95b238","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"7a8689aa.048a08","type":"camerapi-takephoto","z":"2fa4e827.95b238","filemode":"2","filename":"photo1.JPEG","filedefpath":"1","filepath":"","fileformat":"jpeg","resolution":"2","rotation":"0","fliph":"0","flipv":"0","brightness":"50","contrast":"0","sharpness":"0","quality":"80","imageeffect":"none","exposuremode":"auto","iso":"0","agcwait":"1.0","led":"0","awb":"auto","name":"","x":120,"y":200,"wires":[["ba8c5f04.87f7f","5fd26d96.08c704","ff429449.2c49e8","3d347ad9.d8d476","80f12bbd.4e46d8"]]},{"id":"ba8c5f04.87f7f","type":"debug","z":"2fa4e827.95b238","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":570,"y":60,"wires":[]},{"id":"73cec9b1.2686e8","type":"inject","z":"2fa4e827.95b238","name":"","topic":"","payload":"","payloadType":"date","repeat":"30","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":100,"wires":[["7a8689aa.048a08"]]},{"id":"73415897.980618","type":"debug","z":"2fa4e827.95b238","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":610,"y":260,"wires":[]},{"id":"f150943f.0c2128","type":"e-mail","z":"2fa4e827.95b238","server":"smtp.gmail.com","port":"465","secure":true,"tls":true,"name":"devbuild2018@gmail.com","dname":"","x":670,"y":480,"wires":[]},{"id":"5fd26d96.08c704","type":"change","z":"2fa4e827.95b238","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"","fromt":"str","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":320,"y":300,"wires":[["73415897.980618","f150943f.0c2128"]]},{"id":"ff429449.2c49e8","type":"change","z":"2fa4e827.95b238","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":310,"y":340,"wires":[["c3eaa5bd.4650b8","f150943f.0c2128"]]},{"id":"c3eaa5bd.4650b8","type":"debug","z":"2fa4e827.95b238","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":610,"y":320,"wires":[]},{"id":"3d347ad9.d8d476","type":"change","z":"2fa4e827.95b238","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":310,"y":400,"wires":[["97ae27cd.bd0158","f150943f.0c2128"]]},{"id":"97ae27cd.bd0158","type":"debug","z":"2fa4e827.95b238","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":630,"y":380,"wires":[]},{"id":"80f12bbd.4e46d8","type":"function","z":"2fa4e827.95b238","name":"flow 1: setup mail content","func":"msg = {\n    payload : \"Test photo sending \" + new Date().toString(),\n    topic : \"Next Photo\"\n}\nreturn msg;","outputs":1,"noerr":0,"x":330,"y":260,"wires":[["ca52b88a.e69fb8","f150943f.0c2128"]]},{"id":"ca52b88a.e69fb8","type":"debug","z":"2fa4e827.95b238","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":590,"y":160,"wires":[]}]

I tried following the example here:
https://groups.google.com/forum/#!topic/node-red/wBV-5Y_9ZIU

But all I get is a JSON string in the email.

[{"id":"b03b14a6.17b598","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"6a7a8574.dd7cbc","type":"inject","z":"b03b14a6.17b598","name":"","topic":"","payload":"","payloadType":"date","repeat":"7","crontab":"","once":false,"onceDelay":0.1,"x":90,"y":140,"wires":[["e35b65d3.befc38"]]},{"id":"e35b65d3.befc38","type":"camerapi-takephoto","z":"b03b14a6.17b598","filemode":"1","filename":"photo1.JPEG","filedefpath":"0","filepath":"/home/pi/Desktop/Demo","fileformat":"jpeg","resolution":"1","rotation":"0","fliph":"0","flipv":"0","brightness":"50","contrast":"0","sharpness":"0","quality":"80","imageeffect":"none","exposuremode":"auto","iso":"0","agcwait":"1.0","led":"0","awb":"auto","name":"","x":280,"y":160,"wires":[["81f10993.70a368","a70dc83e.de41c8"]]},{"id":"9f1fab58.0710e8","type":"e-mail","z":"b03b14a6.17b598","server":"smtp.gmail.com","port":"465","secure":true,"tls":true,"name":"testmaker2020@gmail.com","dname":"","x":630,"y":300,"wires":[]},{"id":"81f10993.70a368","type":"function","z":"b03b14a6.17b598","name":"","func":"msg.payload={};\nmsg.payload.type=\"photo\";\nmsg.payload.caption=\"Next photo in sequence\";\nmsg.payload.content=\"/home/pi/Desktop/Demophoto1.JPEG\";\nreturn msg;","outputs":1,"noerr":0,"x":400,"y":260,"wires":[["9f1fab58.0710e8","bc4f7f04.4a5a2"]]},{"id":"a70dc83e.de41c8","type":"debug","z":"b03b14a6.17b598","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":500,"y":160,"wires":[]},{"id":"bc4f7f04.4a5a2","type":"debug","z":"b03b14a6.17b598","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":560,"y":240,"wires":[]}]

Please read this post on how to properly share flows and code in the forum: How to share code or flow json

Please edit your post to fix the formatting rather than adding another reply.

1 Like