How to pass variables into an HTML body
<p>I have created this script that allows me to select a certain food item and the serving size and then it calculates nutritional value, adds it to a database, sums it all at the end of the day and sends me an email with an overview. It almost all works, I am just having trouble passing some variables from my script into the HTML formatted email.</p>

<p>In the portion of the code below, <code>totals</code> is the data values from a spreadsheet range. I expect the retrieved values of <code>calories</code>, <code>caloriesFromFat</code>, and <code>polyFat</code> to replace the matching text in the email's <code>htmlBody</code>.</p>

<pre class="lang-js prettyprint-override"><code> var calories = totals[0][25];
    var caloriesFromFat = totals[0][26];
    var polyFat = totals[0][27];
  }
//Sends email with summary
    MailApp.sendEmail({
     to: "user@example.com",
     subject: "Daily Intake Log",
     htmlBody:  &lt;table style="width:100%"&gt;
  &lt;tr&gt;
    &lt;td&gt;Calories&lt;/td&gt;
    &lt;td&gt;calories&lt;/td&gt;       

  &lt;/tr&gt;

  &lt;tr&gt;
    &lt;td&gt;Calories From Fat&lt;/td&gt;
    &lt;td&gt;caloriesFromFat&lt;/td&gt;        

  &lt;/tr&gt;

  &lt;tr&gt;
    &lt;td&gt;PolyUnsaturated&lt;/td&gt;
    &lt;td&gt;polyFat&lt;/td&gt;        

  &lt;/tr&gt;

&lt;/table&gt;

   });
</code></pre>



<p>When I output the contents of the variables <code>calories</code>, <code>caloriesFromFat</code>, and <code>polyFat</code> to the log they all contain the numbers they should. But when I get the email it doesn't insert the variables' contents, just leaves the name of the variables, e.g. <code>calories</code>. </p>

<p>How do I get the computed values into my email?</p>