最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to customize the Meteor accounts verification email template? - Stack Overflow

programmeradmin1浏览0评论

How to customize meteor account email templates? In Meteor startup I have:

Accounts.config({
  sendVerificationEmail: true
});

Is there a way to configure email template? For example, there is a verification link in email, I have to change the link into button.

How to customize meteor account email templates? In Meteor startup I have:

Accounts.config({
  sendVerificationEmail: true
});

Is there a way to configure email template? For example, there is a verification link in email, I have to change the link into button.

Share Improve this question edited Nov 27, 2015 at 10:30 Matthias A. Eckhart 5,1564 gold badges29 silver badges36 bronze badges asked Nov 27, 2015 at 8:51 Ramesh MurugesanRamesh Murugesan 5,0238 gold badges43 silver badges71 bronze badges 1
  • 1 Check the sample in the auth docs. – vjrj Commented Nov 27, 2015 at 10:46
Add a ment  | 

2 Answers 2

Reset to default 10

You can customise the verifyEmail ponent by using the following function:

Accounts.emailTemplates.verifyEmail.text = function(user, url) {
    return 'Your custom text, URL:' + url;
};

Since you want to change the link, you may want to use:

Accounts.emailTemplates.verifyEmail.html = function(user, url) {
    /* Return your HTML code here: */
    return '<h1>Thank you for your registration.</h1><br/><a href="' + url + '">Verify eMail</a>';
};

Read more about Accounts.emailTemplates.

Just to bring more light on this.

Accounts.emailTemplates.verifyEmail = {
    subject() {
        return "Activate your account now!";
    },
    text(user, url) {
        return 'Hey ' + user.profile.name 
        + '! Verify your e-mail by following the link below:\n\n'
        + url;
    }
 };

based on an example from the docs.

发布评论

评论列表(0)

  1. 暂无评论