I need help on sending image attachment on email.
So far i can only send 1 image.
I tried making an array of buffered 2 image as content with their file name on msg.attachments and shows only 1 image on my inbox.
here is what I'm passing through the Email node
Text : msg : Object
object
_msgid: "a21752c86d7ba433"
payload: "Test"
topic: "Text"
attachments: array[2]
0: object
filename: "image.jpg"
content: buffer[786328]
1: object
filename: "image2.jpg"
contnent: buffer[898011]
type or paste code her
Here is my function code
msg.attachments = [
{ filename : "image.jpg",
content : msg.payload[0] },
{
filename : "image2.jpg",
contnent : msg.payload[1]
}
] ;
msg.payload = "Test";
return msg;
here is my example node
[{"id":"5b50a033058e84ac","type":"inject","z":"f7d9d380383efc2a","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"Text","payload":"Test","payloadType":"str","x":2460,"y":800,"wires":[["41fe3747e2aac1bb","a10d4054ff202f35"]]},{"id":"41fe3747e2aac1bb","type":"file in","z":"f7d9d380383efc2a","name":"","filename":"/home/pi/Uga/image.jpg","format":"","chunk":false,"sendError":false,"encoding":"none","allProps":false,"x":2670,"y":800,"wires":[["10ccf85ac0a068a3"]]},{"id":"10ccf85ac0a068a3","type":"join","z":"f7d9d380383efc2a","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"1","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":2890,"y":820,"wires":[["503e46ac8df788d8"]]},{"id":"a10d4054ff202f35","type":"file in","z":"f7d9d380383efc2a","name":"","filename":"/home/pi/Uga/image2.jpg","format":"","chunk":false,"sendError":false,"encoding":"none","allProps":false,"x":2670,"y":840,"wires":[["10ccf85ac0a068a3"]]},{"id":"503e46ac8df788d8","type":"change","z":"f7d9d380383efc2a","name":"","rules":[{"t":"delete","p":"filename","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":3080,"y":820,"wires":[["e213c59b64f2007f"]]},{"id":"e213c59b64f2007f","type":"function","z":"f7d9d380383efc2a","name":"","func":"\nmsg.attachments = [\n { filename : \"image.jpg\",\n content : msg.payload[0] },\n {\n filename : \"image2.jpg\",\n contnent : msg.payload[1]\n }\n \n ] ; \n\nmsg.payload = \"Test\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":2960,"y":920,"wires":[["ae03728b0b94faae","33419b2dd2bc6002"]]},{"id":"33419b2dd2bc6002","type":"e-mail","z":"f7d9d380383efc2a","server":"smtp.gmail.com","port":"465","secure":true,"tls":true,"name":"XXZ@gmail.com","dname":"Send Email","credentials":{"userid":"","password":""},"x":3190,"y":920,"wires":[]},{"id":"ae03728b0b94faae","type":"debug","z":"f7d9d380383efc2a","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":3170,"y":1000,"wires":[]}]