如何在system.net.mail中发送富格文本消息

如何在system.net.mail中发送富格文本消息,.net,.net,如何在system.net.mail中发送富格文本消息需要代码以html格式发送邮件system.net.mail.MailMessage mm=new system.net.mail.MailMessage(); System.Net.Mail.MailMessage mm = new System.Net.Mail.MailMessage(); mm.Body = "<html>...</html>"; mm.IsBodyHtml = true; mm.Body=“

如何在system.net.mail中发送富格文本消息需要代码以html格式发送邮件

system.net.mail.MailMessage mm=new system.net.mail.MailMessage();
System.Net.Mail.MailMessage mm = new System.Net.Mail.MailMessage();
mm.Body = "<html>...</html>";
mm.IsBodyHtml = true;
mm.Body=“…”; mm.IsBodyHtml=true;
System.Net.Mail.MailMessage mm=new System.Net.Mail.MailMessage();
mm.Body=“…”;
mm.IsBodyHtml=true;
//创建邮件消息
MailMessage mail=新的MailMessage();
//设置地址
mail.From=新邮件地址(“me@mycompany.com");
mail.To.Add(“you@yourcompany.com");
//设置内容
mail.Subject=“这是一封电子邮件”;
mail.Body=“这是粗体,这是蓝色”;
mail.IsBodyHtml=true;
//发送消息
SmtpClient smtp=新的SmtpClient(“127.0.0.1”);
smtp.发送(邮件);
//创建邮件消息
MailMessage mail=新的MailMessage();
//设置地址
mail.From=新邮件地址(“me@mycompany.com");
mail.To.Add(“you@yourcompany.com");
//设置内容
mail.Subject=“这是一封电子邮件”;
mail.Body=“这是粗体,这是蓝色”;
mail.IsBodyHtml=true;
//发送消息
SmtpClient smtp=新的SmtpClient(“127.0.0.1”);
smtp.发送(邮件);

您应该知道,并不是每个人/邮件客户端都可以显示HTML格式的消息。如果您依赖于布局来使您的信息清晰,这可能是一个问题

您应该知道,并非每个人/邮件客户端都可以显示HTML格式的消息。如果您依赖于布局来使您的信息清晰,这可能是一个问题

//create the mail message
 MailMessage mail = new MailMessage();

 //set the addresses
 mail.From = new MailAddress("me@mycompany.com");
 mail.To.Add("you@yourcompany.com");

 //set the content
 mail.Subject = "This is an email";
 mail.Body = "<b>This is bold</b> <font color=#336699>This is blue</font>";
 mail.IsBodyHtml = true;

 //send the message
 SmtpClient smtp = new SmtpClient("127.0.0.1");
 smtp.Send(mail);