Ashutosh Priyadarshy
Ashutosh Priyadarshy

Reputation: 260

Using Accounts.emailTemplates.resetPassword.html correctly in Meteor

I have no problems using Accounts.emailTemplates.resetPassword.text but if I also use Accounts.emailTemplates.resetPassword.html I don't get an HTML email.

Are there any example of how to use Accounts.emailTemplates.resetPassword.html correctly?

Upvotes: 4

Views: 1241

Answers (1)

Stephan
Stephan

Reputation: 1279

It is very simple to use - just like you would use text. See the example below, it will send the return value as the e-mail body. Works for all three: resetPassword, verifyEmail, and enrollAccount.

Accounts.emailTemplates.verifyEmail.html = function (user, url) {
    return "<h1>Thanks for signing up!</h1>"
    + " To <strong>activate</strong> your account, click the link below:\n\n"
    + url;
};

Still, both variants are sent as e-mail: text and html. If your e-mail client defaults to display emails as text, then you will not see the HTML flavor of the message, so make sure both text and html contain the same information.

Upvotes: 2

Related Questions