简体   繁体   中英

How to customize the Meteor accounts verification email template?

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.

You can customise the verifyEmail component 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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM