本文介绍了连接尝试失败,因为连接方在一段时间后没有正确响应,或者建立的连接失败,因为连接的主机无法响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在c#发送邮件时收到此信息。
I am getting this when send mail in c#..
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 118.67.248.63:25
我的尝试:
What I have tried:
mail.IsBodyHtml = true;
SmtpClient smtp = new SmtpClient();
smtp.Host = "my own";
smtp.EnableSsl = true;
NetworkCredential NetworkCred = new NetworkCredential();
NetworkCred.UserName = mailID;
NetworkCred.Password = maillIDpass;
smtp.UseDefaultCredentials = true;
smtp.Credentials = NetworkCred;
smtp.Port = 25;
System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate(object s, System.Security.Cryptography.X509Certificates.X509Certificate certificate, System.Security.Cryptography.X509Certificates.X509Chain chain, System.Net.Security.SslPolicyErrors sslPolicyErrors)
{
return true;
};
smtp.Send(mail); //sending Email
推荐答案
smtp.Port = 587;
端口587是需要的MSA端口SMTP认证&在ISP阻塞端口25的情况下,经常使用而不是端口25.
检查此链接 []
这篇关于连接尝试失败,因为连接方在一段时间后没有正确响应,或者建立的连接失败,因为连接的主机无法响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!