Node.js Nodemailer不生成附件内容

时间:2015-07-10 00:28:08

标签: javascript node.js nodemailer

我正在尝试使用nodemailer自动发送电子邮件。问题是我无法获得工作的附件。这是一个示例脚本

var mailOptions = {
    from: 'apples@gmail.com', // sender address
    to: newClient.a22, // list of receivers
    cc: managerEmail, // list of receivers
    bcc: financeEmail, // list of receivers
    subject: newClient.a4 + ' |' + monthofService +' | Revision ID: '+revisionId, // Subject line
    html: printoutfile.replace(/(\n)/g, '<br>'),
    attachments : [ {   // utf-8 string as an attachment
          fileName: 'check.txt',
          contents: 'checking that some attachments work...'
      }]

};

除了附件之外,一切都有效。甚至邮件的文件名

感谢任何帮助,谢谢

1 个答案:

答案 0 :(得分:0)

内容 不是内容。检查nodemailer wesite http://www.nodemailer.com/

上的示例代码
var mailOptions = {
    from: 'apples@gmail.com', // sender address
    to: newClient.a22, // list of receivers
    cc: managerEmail, // list of receivers
    bcc: financeEmail, // list of receivers
    subject: newClient.a4 + ' |' + monthofService +' | Revision ID:'+revisionId, // Subject line
    html: printoutfile.replace(/(\n)/g, '<br>'),
    attachments : [ {   // utf-8 string as an attachment
          fileName: 'check.txt',
          content: 'checking that some attachments work...'
       }]
};