public static int the SendEmail ( String mailContent, String mailsubject, String mailTo ) { // SMTP settings embodiment netease String smtpServer = " smtp.qq.com " ; // "14.18.245.164"; // the SMTP server String mailFrom = "XXXX qq.com @ " ; // username String the userPassword = " XXXXXXXXX " ; // login password // Mail service settings SmtpClient smtpClient =new new the SmtpClient (); smtpClient.EnableSsl = to true ; smtpClient.UseDefaultCredentials = to false ; smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network; // specified Email embodiment smtpClient.Host = smtpServer; // specified SMTP server smtpClient.Timeout = 5000 ; SMTPClient .port = 587 ; smtpClient.Credentials = new new System.Net.NetworkCredential (mailFrom, the userPassword); // username and password MailMessage = MailMessage new new MailMessage (mailFrom, mailTo); // sender and recipient mailMessage.Subject = mailsubject; // theme mailMessage.Body = mailContent; // content mailMessage.BodyEncoding = Encoding.UTF8; // text encoding mailMessage = .IsBodyHtml to true ; // set to HTML mailMessage.Priority = MailPriority.Low; // priority of the try { ServicePointManager.ServerCertificateValidationCallback = the delegate(Object obj, the X509Certificate Certificate, X509Chain catena alberghiera, SslPolicyErrors errors) { return to true ;}; smtpClient.Send (MailMessage); // send a message return . 1 ; } the catch (SmtpException EX) { Logger.Create ( " - Exception mail transmission " , ex.ToString ()); return 0 ; } }