Here is the code to configure Nodemailer to send pics:
javascriptconst mailConfig = { from: 'supermail@supermail.com', to: 'supermail@supermail.com', subject: 'Important email - No, not really', attachments: [{ filename: 'picture.png', path: __dirname + '/Assets/picture.png', cid: 'logo' }], html: `<b>Thanks for reading this important mail.</b> <p><img src = 'cid:logo'></img></p>` };
Some things that I've tried and Gmail doesn't seem to support so far:
The conclusion is that the best approach seems to attach a png
picture and use the cid
as src
.
Hi, I'm Erik, an engineer from Barcelona. If you like the post or have any comments, say hi.