title: Sending Templated emails with node.js, node mailer and nodemailer-mailgun-transport
body: <p>I have the following basic nodejs app:</p>
  
  <pre><code>var nodemailer = require('nodemailer');
  var hbs = require('nodemailer-express-handlebars');
  var options = {
   viewEngine: {
       extname: '.hbs',
       layoutsDir: 'views/email/',
       defaultLayout : 'template',
       partialsDir : 'views/partials/'
   },
   viewPath: 'views/email/',
   extName: '.hbs'
  };
  
  var mg = require('nodemailer-mailgun-transport');
  
  var auth = {
      auth: {
          api_key: ' mailgun api key ',
          domain: ' mailgun email domain '
      }
  }
  
  var mailer = nodemailer.createTransport(mg(auth));
  
  mailer.use('compile', hbs(options));
  mailer.sendMail({
   from: 'test@inventori.io',
   to: 'test@test.com',
   subject: 'Any Subject',
   template: 'email.body',
   context: {
        variable1 : 'value1',
        variable2 : 'value2'
   }
  }, function (error, response) {
      // console.error(error);
      if (error) {
          throw error;
      };
   console.log('mail sent to ',response);
   mailer.close();
  });
  </code></pre>
  
  <p>views/email/template.hbs</p>
  
  <pre><code>{{&gt;email/head}}
  &lt;body&gt;
       {{&gt;email/header}}
       {{{body}}}
       {{&gt;email/footer}}
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>views/email/email.body.hbs</p>
  
  <pre><code>&lt;h4&gt;Main Body Here&lt;/h4&gt;
  {{variable1}} &lt;br/&gt;
  {{variable2}}
  </code></pre>
  
  <p>views/partials/email/header.hbs</p>
  
  <pre><code>&lt;h4&gt;Header Content&lt;/h4&gt;
  </code></pre>
  
  <p>views/partials/email/footer.hbs</p>
  
  <pre><code>&lt;h4&gt;Footer Content&lt;/h4&gt;
  </code></pre>
  
  <p>The handlebars template engine gives zero errors but the mailgun transport throws the following error:</p>
  
  <pre><code>Error: Sorry: template parameter is not supported yet. Check back soon!
      at IncomingMessage.&lt;anonymous&gt; (~/test/node_modules/nodemailer-mailgun-transport/node_modules/mailgun-js/lib/request.js:228:15)
  at IncomingMessage.emit (events.js:129:20)
  at _stream_readable.js:908:16
  at process._tickCallback (node.js:355:11)  
  </code></pre>
  
  <p>This example uses the gmail node mailer transport:</p>
  
  <pre><code>http://excellencenodejsblog.com/express-nodemailer-sending-mails/
  </code></pre>
  
  <p>I would like to be able to send templated emails using mailgun.</p>
  
  <p>Any help would be greatly appreciated.</p>
  
  <p>Thank you.</p>