question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Template does not render handlebar expressions

See original GitHub issue

I got server defined like this:

  const MailQueue = new MailTime({
    db, // MongoDB
    type: 'server',
    strategy: 'backup', // Transports will be used in round robin chain
    transports,
    from() {
      // To pass spam-filters `from` field should be correctly set
      // for each transport, check `transport` object for more options
      return "Example <no-reply@example.com>";
    },
    concatEmails: false, // Concatenate emails to the same addressee
    debug: true
  });

And client like this:

  const MailQueue = new MailTime({
    db, // MongoDB
    transports,
    type: 'client',
    debug: true
  });  

Now I"m sending an email like this:

    MailQueue.sendMail({
      to: 'example@email.com',
      subject: 'You\'ve got an email!',
      user: "John",
      html: template,
      template: "{{{html}}}",
      baseUrl: host
    })

And I load the template like this:

    fs.readFile(process.env.PWD + app.get('templates') + '/email.html', (err, data) => {
      if (err) { reject() };
      resolve(data.toString());
    });

The email sends fine, but the handlebars expressions in the template are not replaced with the opts. What am I doing wrong?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
dr-dimitrucommented, Jan 25, 2018

@satyavh Thank you for noticing this issue.

This was fixed and published as v1.0.0. Please try it at you end.

Feel free to reopen it in case if the issue is still persists on your end.

1reaction
dr-dimitrucommented, Dec 19, 2017

Marked as [bug], thank you for reporting this. Going to double check it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Handlebars Template is not rendered - Stack Overflow
In this instance, your main.js is trying to use a handlebar method/object that doesn't exist yet, because it gets included/executed after you main.js...
Read more >
Expressions | Handlebars
Handlebars expressions are the basic unit of a Handlebars template. You can use them alone in a {{mustache}} , pass them to a...
Read more >
Templating With Handlebars Cheatsheet - Codecademy
Handlebar.compile() can be used to produce a templating function. A template string with expressions must be passed into Handlebar.compile() .
Read more >
Handlebars.js documentation - DevDocs
Handlebars.js 4.0.12 API documentation with instant search, offline support, keyboard shortcuts, mobile version, and more.
Read more >
A Step By Step Guide To Using Handlebars With Your Node js ...
Here's what's going on, Handlebars takes a static template file you give it inside ... By default, if you don't tell handlebars which...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found