try
{
//实例化邮箱消息类 //发邮件人地址
var mail = new MailMessage { From = (new MailAddress(EmailName)) };
//收邮件人地址
mail.To.Add(new MailAddress(address));
//邮件主题
mail.Subject = subject;
//邮件正文
mail.Body = body.ToString();// "邮件发送标内容:测试一下是否发送成功!
//指定邮件格式,支持HTML格式
mail.IsBodyHtml = true;
//邮件采用的编码
mail.BodyEncoding = System.Text.Encoding.GetEncoding("GB2312");
//设置邮件的优先级为高
mail.Priority = MailPriority.Normal;
var smtp = new SmtpClient();
//指定邮箱服务器
smtp.Host = SmtpServer;
//是否加密
smtp.EnableSsl = false;
//
smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
//是否随请求以前发送
smtp.UseDefaultCredentials = true;
smtp.TargetName = "邮件抬头";
//指定服务器邮件,及密码
smtp.Credentials = new NetworkCredential(EmailName, EmailPws);
//发送邮件
smtp.Send(mail);
//释放资源
mail.Dispose();