using System; using System.Net; using System.Net.Mail; class SendEmailWithCS { public string SendMail() { MailMessage mail = new MailMessage(); mail.To.Add("v-anzhu@microsoft.com"); mail.From = new MailAddress("xhinker@163.com"); mail.Body = "a message"; mail.Subject = "a subject"; SmtpClient smtp = new SmtpClient("smtp.163.com,25"); smtp.Credentials = new NetworkCredential("xhinker@163.com", "*********"); smtp.Send(mail); return "ok"; } }