使用nodemailer附加文件时,它未显示错误,但邮件未发送。我对此很陌生。
代码:-
var nodemailer = require('nodemailer');
var transporter = nodemailer.createTransport({
service: '',
auth: {
user: 'test1.co',
pass: 'test'
}
});
const mailOptions = {
from: 'test1.com', // sender address
to: 'test1@gmail.com', // list of receivers
subject: 'Subject of your email', // Subject line
html:{contents}
attachments: [
{ // utf-8 string as an attachment
filename: 'text.ppt',
path:'/Home/Downloads/text.ppt'
},
]
};
transporter.sendMail(mailOptions, function (err, info) {
if(err)
console.log(err)
else
console.log(info);
res.send("Mail Succesfully sent")
});
});
这是我完成的附件。但它不能正常工作
预先感谢