using System.Net;
using System.Net.Mail;
MailMessage mailMessage = new MailMessage();
mailMessage.To.Add("*******@outlook.com");
mailMessage.From = new MailAddress("111111@qq.com");
mailMessage.Subject = "ASP.NET e-mail test";
mailMessage.SubjectEncoding = Encoding.UTF8;
mailMessage.Body = "Hello world,
This is an .NET test e-mail!";
mailMessage.BodyEncoding = Encoding.UTF8;
mailMessage.IsBodyHtml = true;
SmtpClient smtpClient = new SmtpClient();
smtpClient.Host = "smtp.qq.com"; //邮件服务器SMTP
smtpClient.Port = 587; //邮件服务器端口
smtpClient.EnableSsl = true;
smtpClient.Credentials = new NetworkCredential("111111@qq.com", "qq邮箱授权码"); //邮件服务器验证信息, qq邮箱授权码通过设置->账户->开启服务:POP3/SMTP服务获取
smtpClient.Send(mailMessage);