I need to iterate my orders in my .hbs template. My code is given below
`
var nodemailer = require('nodemailer');
var mailerhbs = require('nodemailer-express-handlebars');
let transporter = nodemailer.createTransport({
host: CONSTANT.SMTPHOST,
port: 587,
secure: false,
auth: {
user: CONSTANT.SMTPUSER,
pass: CONSTANT.SMTPPASSWORD,
},
});
`
The problem is that in the mail context I can add access strings only in the hbs template
mailData.context = { orderId : 'testid', // This works user : user // This is object accessing user._id not working in hbs file };
Error I got is given below
Handlebars: Access has been denied to resolve the property "_id" because it is not an "own property" of its parent.
You can add a runtime option to disable the check or this warning:
See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details
I need to iterate my orders in my .hbs template. My code is given below ` var nodemailer = require('nodemailer'); var mailerhbs = require('nodemailer-express-handlebars'); let transporter = nodemailer.createTransport({ host: CONSTANT.SMTPHOST, port: 587, secure: false, auth: { user: CONSTANT.SMTPUSER, pass: CONSTANT.SMTPPASSWORD, }, });
transporter.use('compile', mailerhbs({ viewEngine: { extname: '.hbs', partialsDir: templatePath, layoutsDir: templatePath+'/layouts', defaultLayout: 'blank', }, viewPath: templatePath, extName: '.hbs' }))
` The problem is that in the mail context I can add access strings only in the hbs template
mailData.context = { orderId : 'testid', // This works user : user // This is object accessing user._id not working in hbs file };
Error I got is given below Handlebars: Access has been denied to resolve the property "_id" because it is not an "own property" of its parent. You can add a runtime option to disable the check or this warning: See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details