简体   繁体   中英

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

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+

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM