【问题标题】:How to send html external template in meteor?如何在流星中发送html外部模板?
【发布时间】:2017-08-28 08:26:29
【问题描述】:

我正在使用Accounts.emailTemplates.enrollAccount.html。 我可以使用此代码成功发送电子邮件:

   Accounts.emailTemplates.enrollAccount.html = function(user, url) {
      return '<h1>Thank you </h1><br/><a href="' + url + '">Verify eMail</a>';
  };

但我想做的是,我有一个名为email.html 的外部文件,我想将该文件作为电子邮件发送。 我的代码

  Accounts.emailTemplates.enrollAccount.html = function(user, url) {
      // i want to send email.html file from here or if you have other way
  };

谢谢。

【问题讨论】:

    标签: meteor meteor-accounts


    【解决方案1】:

    你可以像这样使用流星包meteorhacks:ssr

    Accounts.emailTemplates.enrollAccount.html = function(user, url) {
      SSR.compileTemplate('htmlEmailVerify', Assets.getText('email.html'));
      return SSR.render('htmlEmailVerify', {user: user, url: url});
    };
    

    您可以使用空格键标签获取电子邮件 html 代码中的数据: {{user}} & {{url}}

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-03-31
      • 1970-01-01
      • 1970-01-01
      • 2018-06-15
      • 2018-04-27
      • 2014-11-24
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多