string to = "email@hotmail.co.uk";
string body = "Test";
SmtpClient SMTPServer = new SmtpClient("127.0.0.1");
MailMessage mailObj = new MailMessage(urEmail, to, subject, body);
SMTPServer.Send(mailObj);
这就是我目前发送测试邮件的方式。 我如何制作此 html 并能够通过添加图像等使发送的电子邮件看起来更好?
谢谢
最佳答案
在 MailMessage
上将属性 IsBodyHtml
设置为 true。
string to = "email@hotmail.co.uk";
string body = "Test";
SmtpClient SMTPServer = new SmtpClient("127.0.0.1");
MailMessage mailObj = new MailMessage(urEmail, to, subject, body);
mailObj.IsBodyHtml = true; // This line
SMTPServer.Send(mailObj);
关于c# - MailMessage c# - 如何使其成为 HTML 并添加图像等?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7873155/