Embed image in email body nodemailer nodejs

Responding here in case anyone else encounters this! The __dirname above was really helpful, but this is my code to actually see the image embedded in the email

My img tag:

<img src="https://stackoverflow.com/questions/48449379/cid:logo">

My attachments snippet:

attachments: [{
     filename: 'Logo.png',
     path: __dirname +'/folder/Logo.png',
     cid: 'logo' //my mistake was putting "cid:logo@cid" here! 
}]

Leave a Comment