2015-07-10 96 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...' 
     }] 
};