private void toemail() { try { //邮件发送类? MailMessage mail = new MailMessage(); //是谁发送的邮件? mail.From = new MailAddress("2475523429@qq.com", "zx"); //发送给谁? mail.To.Add("442624769@qq.com"); //标题? mail.Subject = "test"; //内容编码? mail.BodyEncoding = Encoding.Default; //发送优先级? mail.Priority = MailPriority.High; //邮件内容? mail.Body = "setet"; //是否HTML形式发送? mail.IsBodyHtml = true; //邮件服务器和端口? SmtpClient smtp = new SmtpClient("smtp.qq.com", 25); smtp.UseDefaultCredentials = false; //指定是否 SmtpClient 使用安全套接字层(SSL) 加密的连接。 smtp.EnableSsl = true; //指定发送方式? smtp.DeliveryMethod = SmtpDeliveryMethod.Network; //指定登录名和密码? smtp.Credentials = new System.Net.NetworkCredential("2475523429", "imjrwmhjheekdhhd"); //超时时间? smtp.Timeout = 10000; smtp.Send(mail); } catch (Exception exp) { MessageBox.Show("发送邮件异常"); } }