首页 > 代码库 > c# 发送邮件

c# 发送邮件

 public static void SendMail(string to, string subject, string content)        {            content = string.Concat(content, Environment.NewLine, "注: 自动测试功能评估阶段,结果仅供参考。");            SmtpClient smtp = new System.Net.Mail.SmtpClient();            smtp.Host = "10.20.80.250";            smtp.Credentials = new NetworkCredential("liguoqiang@yskj.com", "ligq01");            //smtp.Send("liguoqiang@yskj.com", to, subject, content);            MailMessage mail = new MailMessage();            //mail.Sender = new MailAddress("liguoqiang@yskj.com", "系统运行环境检测", Encoding.UTF8);            mail.From = new MailAddress("liguoqiang@yskj.com", "系统运行环境检测", Encoding.UTF8);            //邮件接收人            mail.To.Add(to);            mail.Subject = subject;            mail.SubjectEncoding = Encoding.UTF8;            mail.Body = content;            mail.BodyEncoding = Encoding.UTF8;            mail.IsBodyHtml = true;            smtp.Send(mail);        }

 

c# 发送邮件