0
我試圖使用節點電子郵件模板呈現帕格/玉石模板。無法通過節點電子郵件模板將變量傳遞給pug/jade模板
var confirmCode = generateConfirmCode(configPublic.confirmCodeLength);
var query = querystring.stringify({
code: confirmCode,
id: user._id.toString()
});
var templateDir = path.join(__dirname, '../templates', 'confirmation-email');
var confirmEmail = new EmailTemplate(templateDir);
var confirmUrl = configPublic.url + '/user/email/confirm?' + query;
var templateVals = {url: confirmUrl};
confirmEmail.render(templateVals, function(err, result) {
if (err) {
console.log(err);
}
var mailOptions = {
from: configPrivate.gmail.username,
to: user.email.address,
subject: 'confirmation',
html: result.html
};
email.send(mailOptions)
.then(function (successMsg) {
db.setConfirmCode(user, confirmCode)
.catch(function (err) { // catch setConfirmCode err
deferred.reject(err);
});
deferred.resolve(successMsg);
})
.catch(function (err) { // catch send err
deferred.reject(err);
})
所以我通過templateVals
到渲染調用,我試圖找出如何顯示上所呈現的模板信息,像這樣:
link(rel='stylesheet', href='./style.css')
|
|
p !{url}
p #{url}
p url
p templateVals.url
p #{templateVals.url}
p !{templateVals.url}
,沒有這些組合似乎正在工作。我不確定我在這裏做錯了什麼。謝謝你的幫助!