title: NodeMailer send HTML email with template from database
body: <p>In my app I have set nodemailer to send out emails. The app is built with Vue and Firebase.
  I need to modify email templates from UI, so they are saved in HTML format in database.
  Inside these templates I need to be able to use dynamic values.</p>
  
  <p>This is the method to create the email:</p>
  
  <pre><code> const mailOptions = {
       from: "Test",
       to: req.body.email,
       subject: "New email from" + " " + req.body.email,
       html: req.body.arenile.email_template
    };
  </code></pre>
  
  <p>The content of <code>req.body.arenile.email_template</code> in FireStore is:</p>
  
  <pre><code>&lt;p&gt;Date: ${req.body.reservation_date} &lt;/p&gt;&lt;p&gt;Email: ${req.body.email}&lt;/p&gt;
  </code></pre>
  
  <p>The problem is that variables are not evaluated and printed out on email as they are.</p>
  
  <p>I tried: </p>
  
  <pre><code>html: ` ${req.body.arenile.email_template}`
  </code></pre>
  
  <p>but it doesn't solve it.</p>
  
  <p>If I use:</p>
  
  <pre><code>html: `&lt;p&gt;Date: ${req.body.reservation_date} &lt;/p&gt;&lt;p&gt;Email: ${req.body.email}&lt;/p&gt;`
  </code></pre>
  
  <p>it works fine. <code>${req.body.email}</code> is printed as <code>email@example.com</code></p>
  
  <p>But:</p>
  
  <pre><code>html: ` ${req.body.arenile.email_template}`
  </code></pre>
  
  <p>doesn't. <code>${req.body.email}</code> is printed as <code>${req.body.email}</code></p>
  
  <p>I am not sure if I need to escape HTML differently or if request data are being evaluated in the wrong place..</p>
  
  <p>How can I fix it?</p>