简体   繁体   English

如何在ASP.NET MVC5 Identity 2中添加HTML电子邮件模板以进行电子邮件确认?

[英]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. 默认情况下,此代码附带有asp.net mvc5 Identity 2电子邮件确认。

   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 ? 但是我想添加一个HTML电子邮件模板。那么我该怎么做呢? Thanks 谢谢

We can store the html tag in a variable and then pass that variable to the method UserManager.SendEmailAsync() method. 我们可以将html标签存储在一个变量中,然后将该变量传递给UserManager.SendEmailAsync()方法。

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+ 有关更多详细信息,请检查此链接: http : //forums.asp.net/t/2026812.aspx?How+can+i+add+html+email+template+UI+ for+ email+confirmation+in+asp+净+ mvc5 +身份+ 2 +

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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