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
2 Answers
Reset to default 10You 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.