title: Replacing placeholders in Email Template
body: <p>What is the better way to replace placeholders in email module?</p>
  
  <p>So, I have made a mail service which takes parameters like <code>templatename</code> , <code>receiverMail</code> &amp; <code>locals</code>. locals have the values for placeholders. </p>
  
  <pre><code>var locals = {
      username: "John",
      website: "w3schools.com",
      url: "http:// abc. com"
  };
  
  mail.sendMail('Registration', 'xyz.com', locals);
  </code></pre>
  
  <p>Relevant Code from Mail service :-</p>
  
  <pre><code>var mailOptions = {
          from: "Abc &lt;foo@blurdybloop.com&gt;", // sender address
          to: email, // list of receivers
          subject: template_subject, // Subject line
          html: template_html // html body
  </code></pre>
  
  <p><code>template_html</code> contents the html body including the <code>placeholders</code> this is pulled from mongodb.</p>
  
  <p>The <code>locals</code> are dynamic &amp; can be increased or decreased. </p>
  
  <p>What is the way to replace the placeholders?</p>
  
  <p>Template:- (pls note these placeholders are dynamic &amp; can be changed by admin)</p>
  
  <pre><code>&lt;p&gt;
      Hi {{username}},
  &lt;/p&gt;
  &lt;p&gt;
     Xyz would like you to join it's network on &lt;a href="{{url}}"&gt;xyz&lt;/a&gt;.
      &lt;br /&gt;
      Our website {{ website }}
  &lt;/p&gt;
  </code></pre>