title: Using Jade mail template in Nodemailer
body: <p>I have a contactform created with Nodemailer. Now I want a Jade tempate mail being send whenever the customer submits the contactform. </p>
  
  <p>I already got it working and the mail template is already being send, but somehow the content of the Jade file is being presented in the 'subject' header of the mail. And everyting is presented with all the HTML tags. So, somewhere it goes wrong. </p>
  
  <p>This is my Nodemailer code:</p>
  
  <pre><code>router.post('/contact/send', function(req, res) {
  
    var transporter = nodeMailer.createTransport({
  
    service : 'Gmail',
    auth : {
      user: process.env.GMAIL_USER,
      pass: process.env.GMAIL_PASS
    }
  
    });
  
    var mailOptions = {
      from: req.body.name + ' &amp;lt;' + req.body.email + '&amp;gt;',
      to: 'xxxxx@gmail.com',
      subject:'Website verzoek',
      text:'Er is een website verzoek binnengekomen van '+ req.body.name+' Email: '+req.body.email+'Soort website: '+req.body.website+'Message: '+req.body.message,
      html:'&lt;p&gt;Websiteverzoek van: &lt;/p&gt;&lt;ul&gt;&lt;li&gt;Naam: '+req.body.name+' &lt;/li&gt;&lt;li&gt;Email: '+req.body.email+' &lt;/li&gt;&lt;li&gt;Soort website: '+req.body.website+' &lt;/li&gt;&lt;li&gt;Message: '+req.body.message+' &lt;/li&gt;&lt;/ul&gt;'
    };
  
    transporter.sendMail(mailOptions, function (err, info) {
      if(err) {
        console.log(err);
        res.redirect('/#contact');
      } else {
        console.log('Message send');
        res.redirect('/#contact');
      }
    });
  
    var toAddress = req.body.email;
  
    var sendMail = function(toAddress, subject, content, next) {
      var mailTemplate = {
        from: 'xxxxxx@gmail.com',
        to: toAddress,
        subject: subject,
        html: content
      };
      transporter.sendMail(mailTemplate, next);
    };
  
    var template = process.cwd() + '/views/mails/mail.jade';
  
    fs.readFile(template, 'utf8', function(err, file) {
      if (err) {
        console.log('Error');
      } else {
        var compiledTmpl = jade.compile(file, {filename: template});
        var context = {title: 'Express'};
        var html = compiledTmpl(context);
  
        sendMail(toAddress, html, function(err, response) {
          if(err) {
            console.log('ERROR!');
          } else {
            console.log('Template send');
          }
        });
      }
    });
  
  });
  </code></pre>