本文介绍了MAILMESSAGE C# - 如何使它HTML和添加图片等?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

string to = "[email protected]";
 string body = "Test";
 SmtpClient SMTPServer = new SmtpClient("127.0.0.1");
 MailMessage mailObj = new MailMessage(urEmail, to, subject, body);
 SMTPServer.Send(mailObj);

这就是我目前如何发送一个测试邮件。
如何使这个网站,并能够使电子邮件发送出去看看通过添加图像更好等?

This is how i am currently sending a test email.How do i make this html and be able to make the email sent out look better by adding images etc?

感谢

推荐答案

MAILMESSAGE 设置属性 IsBodyHtml 为true。

On the MailMessage set the property IsBodyHtml to true.

string to = "[email protected]";
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);

这篇关于MAILMESSAGE C# - 如何使它HTML和添加图片等?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-16 14:41