添加网址链接到电子邮件

时间:2016-04-15 00:24:40

标签: meteor

我正在尝试创建自定义网址并将其传递到HTML电子邮件中。但是,当我推送应用程序以包含实时网址时,我必须手动更改网址。有没有办法做到这一点?

我正在尝试做什么:

Dev enviroment
localhost:3000/profile

Live enviroment
www.address.com/profile

-

sendEmail: function (subject, userId) {
    check([subject, userId], [String]);

    // Let other method calls from the same client start running,
    // without waiting for the email sending to complete.
    this.unblock();

    SSR.compileTemplate( 'htmlEmail', Assets.getText( 'sendEmail.html' ) );

    // to find the users info for the logged in users
    // var user = Meteor.user();

    var emailData = {
      url: Meteor.absoluteUrl() + "/profile"
    };

    Email.send({
      to: to,
      from: from,
      subject: subject,
      html: SSR.render( 'htmlEmail', emailData )
    });
  }

1 个答案:

答案 0 :(得分:1)

您需要在生产环境中配置ROOT_URL变量。执行此操作时,方法Meteor.absoluteUrl("/profile")将返回正确的URL。

相关问题