如何自定义Meteor账户验证邮件模板?
How to customize the Meteor accounts verification email template?
如何自定义meteor账户邮件模板?在 Meteor 启动中我有:
Accounts.config({
sendVerificationEmail: true
});
有没有办法配置电子邮件模板?比如email里面有个验证link,我要把link改成button
您可以使用以下函数自定义 verifyEmail
组件:
Accounts.emailTemplates.verifyEmail.text = function(user, url) {
return 'Your custom text, URL:' + url;
};
既然你想改变 link,你可能想使用:
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>';
};
详细了解 Accounts.emailTemplates
。
只是为了进一步说明这一点。
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;
}
};
基于 docs 中的示例。
如何自定义meteor账户邮件模板?在 Meteor 启动中我有:
Accounts.config({
sendVerificationEmail: true
});
有没有办法配置电子邮件模板?比如email里面有个验证link,我要把link改成button
您可以使用以下函数自定义 verifyEmail
组件:
Accounts.emailTemplates.verifyEmail.text = function(user, url) {
return 'Your custom text, URL:' + url;
};
既然你想改变 link,你可能想使用:
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>';
};
详细了解 Accounts.emailTemplates
。
只是为了进一步说明这一点。
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;
}
};
基于 docs 中的示例。