Search code examples
node.jsnodemaileremail-templates

How can I disable mail preview(email-templates) in node js?


I am using nodemailer with email-templates. I can send emails to users. The only issue I am facing that it is previewing emails every time. Will you please tell me how can I disable it?

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
              }
            }
          });

Solution

  • Silly mistake, but I just need to add preview:false