2015-07-10 92 views
0

我试图用nodemailer自动化电子邮件。问题是我无法获得附件的工作。这里是一个示例脚本Node.js Nodemailer不生成附件内容

var mailOptions = { 
    from: '[email protected]', // 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...' 
     }] 

}; 

除了附件的一切工作。即使邮件

任何帮助的文件名,将不胜感激,谢谢

回答

0

内容没有内容。检查节点上的示例代码wesite http://www.nodemailer.com/

var mailOptions = { 
    from: '[email protected]', // 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...' 
     }] 
};