/// <summary>
/// 发送邮件
/// </summary>
/// <param name="send">发信人地址</param>
/// <param name="receive">收信人地址</param>
/// <param name="subject">邮件标题</param>
/// <param name="body">邮件正文</param>
/// <param name="userName">用户名</param>
/// <param name="password">密码</param>
/// <param name="smtpHost">smtp地址</param>
/// <param name="IsHtml">是否是HTML格式的邮件</param>
public void SendMail(string send, string receive, string subject, string body, string userName, string password, string smtpHost, bool IsHtml)
{
//string send = "phcis@163.com";//发送邮件的mail地址
//string receive = "phcis@163.com";//接收邮件的mail地址
//string subject = "邮件主题";//邮件主题
//string userName = "userName";//发送邮件使用的用户名
//string password = "userPwd";//发送邮件使用的密码
//string smtpHost = "smtp.xxx.com";//smtp地址,如smtp.163.com
SmtpClient smtp = new SmtpClient(smtpHost);
smtp.Credentials = new System.Net.NetworkCredential(userName, password);
MailMessage mes = new MailMessage();
mes.From = new MailAddress(send);
mes.To.Add(receive);
mes.Subject = subject;
mes.Body = body;
mes.IsBodyHtml = IsHtml;//使用是否html格式
//增加附件
//System.Net.Mail.Attachment mailAttach = new Attachment(@"d:\b.txt");
//mes.Attachments.Add(mailAttach);
smtp.Send(mes);
//mailAttach.Dispose();//释放由附件占用的资源
}