2016-04-15 251 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。

相關問題