【发布时间】:2020-04-18 02:33:13
【问题描述】:
所以我的 nodemailer 传输工作正常(大部分情况下)但是,我现在正在尝试嵌入图像。现在的问题是我的 mailOptions 对象中有附加的“附件”选项,它会引发以下错误。
Error: 'from' parameter is missing
这很奇怪,因为我肯定有一个 from 参数。没有附件的电子邮件可以正常发送。不知道我做错了什么。
var mailOptions = {
from: 'confirmation@donotreply.com',
to: email,
subject: 'Account verification',
html:'<p>Hello,\n\n' + 'Please verify your account by clicking the link' + confirmationLink + '\n\n' + '<img src="uniqueqr@qr.example" alt="something went wrong"/>',
attachments: [{
filename: 'qr.png',
path: '../path/to/my/file/qr.png',
cid: 'uniqueqr@qr.example'
}],
};
【问题讨论】:
-
确保关闭 html 中的
<p>标记,并在关闭方括号后去掉最后一个逗号 -
欣赏它,但运气不好,我已经尝试了所有逗号组合,没有逗号等,关闭 并没有什么不同,但总体而言是一个很好的收获。谢谢。
标签: node.js nodemailer