簡體   English   中英

EISDIR:對目錄進行非法操作,讀取+ Nodemailer映像附件

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM