forwardemail / email-templates

Create, preview (browser/iOS Simulator), and send custom email templates for Node.js. Made for @forwardemail, @ladjs, @cabinjs, @spamscanner, and @breejs.
https://forwardemail.net/docs/send-emails-with-node-js-javascript
MIT License
3.64k stars 339 forks source link

can not access locals inside the pug file #418

Closed Iamhashim92 closed 3 years ago

Iamhashim92 commented 3 years ago

Hi, I have a email template i am trying to render. Here is the render config email.render(root, { message: { to: 'iamhashim@yopmail.com', }, locals: { locale: 'en', first_name: 'John', email: 'john@gmmail.com', reset_password_url: 'http://localhost:8080/forget', }, }).then(console.log) .catch(console.error)

and i am trying to access the locals like this p=${t('email.forget.hi')}, ${first_name}``

locale is working fine but i can't access other locals, it is rendering the following tag <p>Hi, undefined</p> version- 8.0.3

niftylettuce commented 3 years ago

You have email.forget.hi not email? Your code is not reproducible.

Iamhashim92 commented 3 years ago

email.forget.hi is inside i18n t function which is working fine, i am not able to access first_name

niftylettuce commented 3 years ago

I need a reproducible test case / source code / repository