你的位置:首页 > ASP.net教程

[ASP.net教程].net如何发送格式化的文本内容


MailMessage mailMessage = new MailMessage();
ArrayList attachsendObject = new ArrayList();
string mailServer = "internalmail.morningstar.com";
mailMessage.From = new MailAddress("Datamanager@morningstar.com");
mailMessage.Subject = "Error message auto-generated for CIT Operation Template";
//mailMessage.To.Add(UserEmail);
mailMessage.CC.Add("Daniel.Cui@morningstar.com");
// mailMessage.CC.Add("William.Huang@morningstar.com");
mailMessage.Body = "<table style='border:1px solid;'><tr><td><font color='red'>邮件测试,呵呵</font></td></tr></table>";
mailMessage.IsBodyHtml = true;
mailMessage.BodyEncoding = System.Text.Encoding.UTF8;
SmtpClient client = new SmtpClient(mailServer);
client.Send(mailMessage);
Console.ReadKey();