2016-04-15 252 views
0

我想创建一个自定义url并将其传递到HTML电子邮件。该电子邮件的作品,但现在我必须手动更改网址,当我推动应用程序生活包含实时网址。有没有办法做到这一点?添加url链接到电子邮件

我想要做的事:

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

您需要在您的生产环境中配置ROOT_URL变量。当您这样做时,方法Meteor.absoluteUrl("/profile")将返回正确的URL。

相关问题