How to send an image from mqtt in an email

Sure the examples help you - you adapt them. Just because someone hasnt done it before they ceraintly have send images, they have converted buffers to base64 and back.

So taking this thread

I made this...
image

and received this in my inbox...

sample flow (note i deleted the email node for privacy)...

[{"id":"e73e2624.4459a8","type":"inject","z":"e360ac5b.0ab79","name":"base 64 image","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"NR Test image","payload":"iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAABmJLR0QA/wD/AP+gvaeTAAALuUlEQVR4nO3deYxdVR3A8e90hS62laXQFoQoCIhgURDBjcW4EIIKBnElGg0IKgKRENGIgCFiUASXKEaUGEmMLJG4EWkVS6kbBUuVRSkttEVQ2g5LS9sZ//idm3fnzjnvzXTsLOX7SV7ue/fce+fOm/O755zfPbcFSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSSOma6RPYBtMAv4OPAmsBR4rLB8HekfoHKURcxRR8Tu9ZozUCWrHMW6kT2AbvH6A203brmehFwQDRGpjrAVIF9HFGggDREM2YaRPYJAOAnbJrO+lf8JhelrOBt4KrAFWp9dT2+sEtWMZawFS6l79C3hpY13VguwJ/LBRtgLYN73/IHAYrezXKuA+IkumF7ixFiBHZ9Y9AfyTcoBsyuwztfb+o8CbGuVnAd8C9gNuJQLnUSJ1vAq4CugZzIlrbBprAfKGzLolwE6Z9VWAbMyUTagtD8+UV2OzY4D906vyAPC19P5FwPnAScDBab9NwD3AncC1RGukMWosBcg8YJ/M+sXAsZn17VqQ8Wl5CDAlU16NZ47JlN2Zli8Dfk904eomA0ek1yeBL6VX0wTg7USAzibGUSuAe4HbyQe2VPRe8jcEjyUqVHP9RWm/XTJlz6SyswrH/DQRJGsyZR8nWoplhX1zr883fpfDgUfabL8O+DL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":60,"wires":[["e5f61250.26cb4"]]},{"id":"e5f61250.26cb4","type":"base64","z":"e360ac5b.0ab79","name":"","action":"","property":"payload","x":320,"y":60,"wires":[["604a8eaf.6d4ac","d6ca2446.6053c8"]]},{"id":"604a8eaf.6d4ac","type":"change","z":"e360ac5b.0ab79","name":"Flow 3 : Setup mail content","rules":[{"t":"set","p":"cid","pt":"msg","to":"","tot":"date"},{"t":"set","p":"attachments","pt":"msg","to":"[{\t    \"filename\": 'image_' & $replace($now(),\":\",\"_\") & '.jpg', \t    \"content\": $$.payload,\t    \"cid\": \"\" & cid & \"\"\t}]","tot":"jsonata"},{"t":"set","p":"topic","pt":"msg","to":"See attached image","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"'<img src=\"cid:' & cid & '\"/>'","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":180,"y":120,"wires":[["58495115.e70dc","e7e50356.464ba"]]},{"id":"58495115.e70dc","type":"debug","z":"e360ac5b.0ab79","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"auto","x":170,"y":200,"wires":[]}]
1 Like