ABP 邮箱设置

以上为QQ企业邮箱配置  密码为企业邮箱密码

个人QQ邮箱 需要在邮箱设置里面  在账号里面打开  POP3/SMTP服务 密码为授权码

并把SMTP服务器设置为 smtp.qq.com

QQ邮箱控制台源码

MailMessage myMail = new MailMessage();
//发件箱
string fromAddress = ConfigurationManager.AppSettings["MailMessage_FromAddress"];//"xxxxx@qq.com";
//收件箱
string toAddress = "xxxxx@163.com";
myMail.From = new MailAddress(fromAddress);
myMail.To.Add(new MailAddress(toAddress));

myMail.Subject = "title";
myMail.SubjectEncoding = Encoding.UTF8;

myMail.Body = "邮箱内容";
myMail.BodyEncoding = Encoding.UTF8;
myMail.IsBodyHtml = true;

SmtpClient smtp = new SmtpClient();
smtp.Host = "smtp.qq.com";
smtp.Port = 587;
smtp.EnableSsl = true;
smtp.Credentials = new NetworkCredential("qq", "qq授权码");


try
{
smtp.Send(myMail);
}
catch (Exception ex)
{
//记录错误日志
}

原文地址:https://www.cnblogs.com/aishangyipiyema/p/5981334.html