首页 > 解决方案 > 如何在节点 js 中禁用邮件预览(电子邮件模板)?

问题描述

我正在使用带有电子邮件模板的 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
              }
            }
          });

标签: node.jsnodemaileremail-templates

解决方案


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


推荐阅读