title: How to read HTML (for email body) from another file in NodeJS
body: <p>I am new to NodeJS.
  I started working on a contact us page, which, when submitted, sends out an acknowledgement email with following HTML to user.</p>
  
  <pre><code>&lt;p&gt;Hello Sujit,&lt;/p&gt;
  &lt;p&gt;Thank you for approaching us.&lt;/p&gt;
  &lt;p&gt;We have received your request and our executive will get in touch with you soon.&lt;/p&gt;
  &lt;p&gt;Thank you.&lt;/p&gt;
  </code></pre>
  
  <p>Following is the code to send email:</p>
  
  <pre><code>var mailer = require("nodemailer");
  
  var emailBody = "&lt;HTML above&gt;";
  
  // Use Smtp Protocol to send Email
  var smtpTransport = mailer.createTransport("SMTP",{
      service: "#######",
      auth: {
          user: "#########",
          pass: "#######"
      }
  });
  
  var mail = {
      from: "######################",
      to: params.email,
      subject: "Welcome user.",
      text: "",
      html: emailBody
  }
  
  smtpTransport.sendMail(mail, function(error, response){
      if(error){
          console.log("Mail error:&gt;&gt;");
          console.log(error);
      }else{
          console.log("Message sent: " + response.message);
      }
  
      smtpTransport.close();
  });
  </code></pre>
  
  <p>Currently, using nodemailer, I am sending this email with the HTML body defined in the same file - app.js. It is working fine so far.
  But, is there any way I can separate the HTML with variables/placeholders for "name" and place in some other file, so that the body content can be managed directly? Some way by which I can load the body content into the variable <code>emailBody</code>.</p>
  
  <p>Thanks.</p>