public bool Send() { //mail message MailMessage myMail = new MailMessage(); myMail.From = new MailAddress("123@163.com"); // 發送人 myMail.To.Add(new MailAddress("456@163.com")); // 接收人郵箱 myMail.Subject = "測試郵件發送--主題"; myMail.SubjectEncoding = Encoding.UTF8; myMail.Body = "測試郵件發送--正文測試郵件發送--正文測試郵件發送--正文測試郵件發送--正文測試郵件發送--正文"; myMail.BodyEncoding = Encoding.UTF8; myMail.IsBodyHtml = false; myMail.Priority = MailPriority.Normal; // 郵件級別 //myMail.CC.Add(new MailAddress("test@163.com")); // 抄送 //myMail.Bcc.Add(new MailAddress("test@163.com")); // 密送 //Smtp Client SmtpClient sender = new SmtpClient(); sender.Host = "smtp.163.com";// email.Host; //sender.Port = 80; // 設置發送人的郵箱和密碼 sender.Credentials = new NetworkCredential("123@163.com", "3232"); sender.DeliveryMethod = SmtpDeliveryMethod.Network; sender.EnableSsl = false; // 是否啓用 SSL 加密 try { sender.Send(myMail); return true; } catch (Exception e) { throw new Exception(e.Message); } }