[英]EISDIR: illegal operation on a directory, read + Nodemailer image attachment
我只是想知道如何在Nodemailer的附件中指定路徑。 我收到了上述錯誤。 誰能指定如何指定路徑?
var imagePath = path.join(__dirname, '/images/')
attachments : [{ filename: "Header@3x.png", path:
$ {imagePath} , cid: 'headerImage' }]
我有同樣的問題。 但是我通過給出直到Image的完整路徑來解決。
例如:
var imagePath = path.join(__dirname, '/images/Header@3x.png'); // In this line, Give the full path of image.
attachments : [{
filename: "Header@3x.png",
path:${imagePath}, // __dirname+'/images/Header@3x.png'
cid: 'headerImage'
}]
您的HTML將是:
<div>
<img src="cid:headerImage" alt="Header Image" width="100" height="100"/>
</div>
(在IMAGE_NAME路徑中很重要,也是必需的。)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.