【问题标题】:Node.js Nodemailer does not generate attachment contentNode.js Nodemailer 不生成附件内容
【发布时间】:2015-07-10 00:28:07
【问题描述】:

我正在尝试使用 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...'
      }]

};

除附件部分外,一切正常。甚至是邮件程序的文件名

任何帮助将不胜感激,谢谢

【问题讨论】:

    标签: javascript node.js nodemailer


    【解决方案1】:

    它的内容不是内容。查看nodemailer网站上的示例代码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...'
           }]
    };
    

    【讨论】:

      猜你喜欢
      • 2021-09-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-08-02
      • 2017-08-12
      • 2017-11-16
      相关资源
      最近更新 更多