Search code examples
asp.netasp.net-mvcasp.net-mvc-5asp.net-identityasp.net-identity-2

How can i add html email template for email confirmation in asp.net mvc5 identity 2?


By Default asp.net mvc5 Identity 2 email confirmation comes with this code.

   await UserManager.SendEmailAsync(user.Id, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>");

But i want to add a html email template.So how can i do this ? Thanks


Solution

  • We can store the html tag in a variable and then pass that variable to the method UserManager.SendEmailAsync() method.

    string message = "<h3>Your Email Tempalte</h3>";
    await UserManager.SendEmailAsync(user.Id, "Confirm your account", message);
    

    For more details please check this link: http://forums.asp.net/t/2026812.aspx?How+can+i+add+html+email+template+UI+for+email+confirmation+in+asp+net+mvc5+identity+2+