baidu_28643993
baidu_28643993
2015-06-02 03:01

WPF实现发送邮件功能,邮件发不出去怎么回事。求助!

  • message

MailMessage message = new MailMessage();
message.To.Add("123456@qq.com");
message.From = new MailAddress("654321@qq.com");
message.Subject = "SUBJECT SUBJECT";
message.SubjectEncoding = Encoding.UTF8;
message.Body = "Body Body";
message.BodyEncoding = Encoding.UTF8;
message.IsBodyHtml = false;
message.Priority = MailPriority.Normal;
SmtpClient smtp = new SmtpClient();
smtp.Credentials = new System.Net.NetworkCredential("654321","password");
smtp.Host = "smtp.qq.com";
smtp.Port = 25;
object userState = message;
smtp.SendAsync(message,userState);

上面是代码,不知道什么问题,运行不报错,就是收不到邮件。我是用的qq邮箱发的。

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

5条回答