为什么nodemailer attatchments路径不起作用没有错误

时间:2018-09-14 06:08:05

标签: reactjs express nodemailer

使用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")
 });
});

这是我完成的附件。但它不能正常工作

预先感谢

0 个答案:

没有答案