本文介绍了使用smtp.gmail发送邮件会出现错误发送邮件失败.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正尝试在C#win应用中使用smtp.gmail发送邮件.它给了我错误
无法连接到远程服务器.
连接尝试失败,因为一段时间后连接方未正确响应,或者建立的连接失败,因为连接的主机未能响应74.125.127.109:587
以下代码可能有什么问题.任何帮助将不胜感激
i am trying to send mail using smtp.gmail in C# win app. it gives me error
Unable to connect to the remote server.
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 74.125.127.109:587
What could be wrong with following code. Any help would be greatly appreciated
System.Net.Mail.MailMessage MyMailMessage = new System.Net.Mail.MailMessage();
MyMailMessage.From = new System.Net.Mail.MailAddress("[email protected]");
MyMailMessage.To.Add("[email protected]");
MyMailMessage.Subject = "Feedback Form";
MyMailMessage.Body = "this is test";
System.Net.Mail.SmtpClient SMTPServer = new System.Net.Mail.SmtpClient("smtp.gmail.com");
SMTPServer.Port = 587;
SMTPServer.Credentials = new System.Net.NetworkCredential("[email protected]", "password");
SMTPServer.EnableSsl = true;
SMTPServer.Send(MyMailMessage);
推荐答案
这篇关于使用smtp.gmail发送邮件会出现错误发送邮件失败.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!