因为连接方在一段时间后没有正确响应

因为连接方在一段时间后没有正确响应

本文介绍了在asp.net中发送电子邮件连接尝试失败,因为连接方在一段时间后没有正确响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 大家好,   我发送电子邮件,但在此行收到此错误 smtpClient.Send(mail); "连接尝试失败,因为连接方在一段时间后没有正确响应,或者建立的连接失败,因为连接的主机未能响应IP地址...   MailMessage mail = new MailMessage (); mail.To.Add( " [email protected]" ); mail.From = new MailAddress (txtEmail.Text); mail.Subject = "测试电子邮件" ;   string Body = "Demo Email trial" ; mail.Body =正文; mail.IsBodyHtml = true ;   SmtpClient smtpClient = new SmtpClient (); smtpClient.Host = " mail.mywebname.com" ; smtpClient.Credentials = new System.Net。 NetworkCredential ( " [email protected]" , " passwd" ); smtpClient.Send(mail );   plz帮助我 解决方案 检查您的主机地址是否正确。我认为代码中缺少SMTP客户端的端口。检查你的Smtp客户端是否需要安全连接(SSL)。问题可能是因为上述三个中的一个。 下面的链接包含使用Smtpclient发送电子邮件的示例代码 http://gauravkhanna.blog.co.in/2008/07/13/send-email-from-your-gmail-account/Hi everyone, I am sending email , but getting this error on this linesmtpClient.Send(mail);"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 IP adress ... MailMessage mail =newMailMessage();mail.To.Add("[email protected]");mail.From =newMailAddress(txtEmail.Text);mail.Subject ="Testing Email"; string Body ="Demo Email trial";mail.Body = Body;mail.IsBodyHtml =true; SmtpClient smtpClient =newSmtpClient();smtpClient.Host ="mail.mywebname.com";smtpClient.Credentials =new System.Net.NetworkCredential("[email protected]","passwd");smtpClient.Send(mail); plz help me 解决方案 Check whether your host address is correct or not.  I think  Port for your SMTP Client is missing in the code. Also do check whether your Smtp Client require Secure Connection (SSL) or not. The problem could be because one of above three.Below link contains example code to send email using Smtpclienthttp://gauravkhanna.blog.co.in/2008/07/13/send-email-from-your-gmail-account/ 这篇关于在asp.net中发送电子邮件连接尝试失败,因为连接方在一段时间后没有正确响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
09-02 00:57