是否有更好的方法在C#中生成HTML电子邮件(通过System.Net.Mail发送),而不是使用Stringbuilder执行以下操作:
string userName = "John Doe";
StringBuilder mailBody = new StringBuilder();
mailBody.AppendFormat("<h1>Heading Here</h1>");
mailBody.AppendFormat("Dear {0}," userName);
mailBody.AppendFormat("<br />");
mailBody.AppendFormat("<p>First part of the email body goes here</p>");
Run Code Online (Sandbox Code Playgroud)
等等等等?
在我的项目中,我遇到了这个错误:
错误1命名空间"System.Web"中不存在类型或命名空间名称"UI"(您是否缺少程序集引用?)
所以,基本上我试图添加"system.web"作为我的项目的引用,但我的.NET框架中没有这样的东西.
我该如何安装"system.web"?