节点邮件附件文本文件



我未能将之前在脚本中创建的 txt 文件附加到要通过 nodemailer 发送的邮件中。邮件已成功发送,但为空。我将如何解决这个问题?

var nodemailer = require ('nodemailer');
let transporter = nodemailer.createTransport({
  service: 'gmail',
  secure: false,
  port: 460,
  auth: {
    user: 'name@gmail.com',
    pass: 'password'
  },
  tls: {
    rejectUnauthorized: false
  }
});
let mailOptions = {
  from: "name" <'name@gmail.com',
  to: 'name@gmail.com',
  subject: 'group_1',
  attachement: [ {
    filename: 'group_1.txt',
    path: /Users/derinserbetcioglu/Documents/NodeJS/'group_1.txt' } ]
};
transporter.sendMail(mailOptions, (error, info) => {
  if (error){
    console.log(error);
  }
  console.log("the message was successfully sent!")
  console.log(info);
})

尝试将路径作为路径:

    '/Users/derinserbetcioglu/Documents/NodeJS/group_1.txt'
    instead of path: /Users/derinserbetcioglu/Documents/NodeJS/'group_1.txt'

我认为应该是依恋而不是依恋

相关内容

  • 没有找到相关文章

最新更新