Reputation: 2913
I'n building a web app by using Sails framework. I am unable to attach an image in email.
Here is my mail options,
var mailOptions = {
from: '[email protected]',
to: to,
subject: subject,
html: html,
attachments: [{
filename: "login-logo.png",
filePath: "./assets/images/login-logo.png",
cid: "logo-mail"
}]
};
and my ejs where I attach an image,
<img src="cid:logo-mail" />
At filePath I try
But didn't work.
I don't know how to fix it. I really need some help.
Thanks.
Upvotes: 1
Views: 1298
Reputation: 21
I had the same problem and this works for me:
var mailOptions = {
from: '[email protected]',
to: to,
subject: subject,
html: html,
attachments: [{
filename: 'Logo.png',
filePath: 'assets/images/Logo.png',
cid: 'logo'
}]
}
I used nodemailer 0.7.1
Upvotes: 1