mvc利用qq邮箱发送验证网页
1.开启qq邮箱中的服务,需要记住授权码
2.
MailAddress from = new MailAddress("email", "server");
MailAddress to = new MailAddress("", "client");
SmtpClient client = new SmtpClient();
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.Host = "smtp.qq.com";
client.EnableSsl = true;
client.Credentials = new System.Net.NetworkCredential("email", "pos"); //email为邮箱地址,pos为授权码
MailMessage message = new MailMessage(from,to);
message.Subject = "test send";
message.Body = @"you can send an email message from an application very easily.";
message.Priority = MailPriority.Low;
try
{
client.Send(message);
}
catch (Exception ex)
{
}