如何在节点 js 中禁用邮件预览(电子邮件模板)?

Sim*_*mar 3 email-templates node.js nodemailer

我正在使用带有电子邮件模板的 nodemailer。我可以向用户发送电子邮件。我面临的唯一问题是每次都预览电子邮件。你能告诉我如何禁用它吗?

var email = new EmailTemplate({
            message: {
              from: 'abc@****.com',
            },
            // uncomment below to send emails in development/test env:
            send: true,
            transport: {
              jsonTransport: true
            },
            preview:'production', // tried with production and development but is of no use
            views: {
              options: {
                extension: 'ejs' // <---- HERE
              }
            }
          });
Run Code Online (Sandbox Code Playgroud)

Sim*_*mar 8

愚蠢的错误,但我只需要添加 preview:false

  • 旁注:一旦通过 NODE_ENV 将应用程序部署到生产环境,预览默认为 false (2认同)