如何向express-mailer添加变量

时间:2015-11-04 01:28:22

标签: javascript express

我使用express-mailer发送电子邮件,但是记录的向电子邮件模板添加变量的方法无效。有谁知道解决方案?

  app.mailer.send('email', {
    to: 'example@example.com', // REQUIRED. This can be a comma delimited string just like a normal email to field. 
    subject: 'Test Email', // REQUIRED.
    otherProperty: 'Other Property' // All additional properties are also passed to the template as local variables.
  }, function (err) {
    if (err) {
      // handle error
      console.log(err);
      res.send('There was an error sending the email');
      return;
    }
    res.send('Email Sent');
  });

  //- in jade template
  h1 {{otherProprety}}

不起作用。

0 个答案:

没有答案