Search code examples
javascriptmeteormeteor-accounts

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.


Solution

  • 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.