public class SystemMail ... { public SystemMail() ...{ } ...#region private string _to; public string To ...{ get ...{ return _to; } set ...{ _to = value; } } private string _from = "abc@163.com"; public string From ...{ get ...{ return _from; } set ...{ _from = value; } } private string _subject; public string Subject ...{ get ...{ return _subject; } set ...{ _subject = value; } } private string _body; public string Body ...{ get ...{ return _body; } set ...{ _body = value; } } #endregion private string _adminEmail = "abc@163.com"; public string AdminEmail ...{ get ...{ return _adminEmail; } set ...{ _adminEmail = value; } } private string _smtpServer = "smtp.163.com"; public string SmtpServer ...{ get ...{ return _smtpServer; } set ...{ _smtpServer = value; } } private string _BodyFormat = "html"; public string BodyFormat ...{ get ...{ return _BodyFormat; } set ...{ _BodyFormat = value; } } private string _BodyEncoding = "gb2312"; public string BodyEncoding ...{ get ...{ return _BodyEncoding; } set ...{ _BodyEncoding = value; } } private string _password = "111111"; public string Password ...{ get ...{ return _password; } set ...{ _password = value; } } private string _userName = "online"; public string UserName ...{ get ...{ return _userName; } set ...{ _userName = value; } } public bool Send() ...{ try ...{ System.Net.Mail.SmtpClient SC = new SmtpClient(); SC.Host = this.SmtpServer; SC.UseDefaultCredentials = false; SC.Port = 25; System.Net.NetworkCredential basicAuthenticationInfo = new System.Net.NetworkCredential(this.UserName, this.Password); SC.Credentials = basicAuthenticationInfo; MailMessage em = new MailMessage(); em.To.Add(new System.Net.Mail.MailAddress(this.To)); em.From = new MailAddress(this.From); em.Subject = this.Subject; em.Body = this.Body; em.SubjectEncoding = System.Text.Encoding.GetEncoding(_BodyEncoding); if (_BodyEncoding != "") ...{ em.BodyEncoding = System.Text.Encoding.GetEncoding(_BodyEncoding); } if (_BodyFormat.ToLower() == "html") ...{ em.IsBodyHtml = true; } else ...{ em.IsBodyHtml = false; } SC.Send(em); return true; } catch (System.Exception E) ...{ return false; } } }