来自 WebException 的 SmtpException:无法连接到远程服务器
我正在尝试使用 smtp 服务器发送邮件,但出现以下异常。 请给我一些建议..
System.Net.Mail.SmtpException:发送邮件失败。
---> System.Net.WebException:无法连接到远程服务器
---> System.Net.Sockets.SocketException:尝试对无法访问的网络 184.xx.xxx.xx:25 进行套接字操作
在 System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress 套接字地址)
在 System.Net.Sockets.Socket.InternalConnect(端点远程EP)
在 System.Net.ServicePoint.ConnectSocketInternal(布尔 connectFailure、Socket s4、Socket s6、Socket 和套接字、IPAddress 和地址、ConnectSocketState 状态、IAsyncResult asyncResult、Int32 超时、Exception 和异常)
--- 内部异常堆栈跟踪结束 ---
在 System.Net.ServicePoint.GetConnection(PooledStream PooledStream、对象所有者、布尔异步、IPAddress& 地址、Socket& abortSocket、Socket& abortSocket 6、Int32 超时)
在 System.Net.PooledStream.Activate(对象 owningObject,布尔异步,Int32 超时,GeneralAsyncDelegate asyncCallback)
在 System.Net.PooledStream.Activate(对象 owningObject,GeneralAsyncDelegate asyncCallback)
在 System.Net.ConnectionPool.GetConnection(对象 owningObject,GeneralAsyncD elegate asyncCallback,Int32creationTimeout)
在 System.Net.Mail.SmtpConnection.GetConnection(字符串主机,Int32 端口)
在 System.Net.Mail.SmtpTransport.GetConnection(字符串主机,Int32 端口)
在 System.Net.Mail.SmtpClient.GetConnection()
在 System.Net.Mail.SmtpClient.Send(MailMessage 消息)
--- 内部异常堆栈跟踪结束 ---
在 E:\testEmail\testEmail\Module1.vb 中的 testEmail.Module1.Main() 处的 System.Net.Mail.SmtpClient.Send(MailMessage message):第 17 行
I am trying to send mail using smtp server but i am getting following Exception.
Please give me some advice..
System.Net.Mail.SmtpException: Failure sending mail.
---> System.Net.WebException: Unable to connect to the remote server
---> System.Net.Sockets.SocketException: A socket operation was attempted to an unreachable network 184.xx.xxx.xx:25
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception)
--- End of inner exception stack trace ---
at System.Net.ServicePoint.GetConnection(PooledStream PooledStream, Object owner, Boolean async, IPAddress& address, Socket& abortSocket, Socket& abortSocket 6, Int32 timeout)
at System.Net.PooledStream.Activate(Object owningObject, Boolean async, Int32 timeout, GeneralAsyncDelegate asyncCallback)
at System.Net.PooledStream.Activate(Object owningObject, GeneralAsyncDelegate asyncCallback)
at System.Net.ConnectionPool.GetConnection(Object owningObject, GeneralAsyncD elegate asyncCallback, Int32 creationTimeout)
at System.Net.Mail.SmtpConnection.GetConnection(String host, Int32 port)
at System.Net.Mail.SmtpTransport.GetConnection(String host, Int32 port)
at System.Net.Mail.SmtpClient.GetConnection()
at System.Net.Mail.SmtpClient.Send(MailMessage message)
--- End of inner exception stack trace ---
at System.Net.Mail.SmtpClient.Send(MailMessage message) at testEmail.Module1.Main() in E:\testEmail\testEmail\Module1.vb:line 17
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

发布评论
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
从这条消息
尝试对无法访问的网络 184.xx.xxx.xx:25 进行套接字操作
来看,您似乎无法到达 SMTP 地址。
检查您的互联网连接,然后检查地址是否正确。
如果地址正确,对地址进行 Ping 或跟踪可以帮助您了解为什么无法联系服务器
From this messagge
A socket operation was attempted to an unreachable network 184.xx.xxx.xx:25
it seems that you cannot reach the SMTP address.
Check your internet connection and then check if the address is correct.
A Ping to the address or a tracerout can help you understand why you cannot contact the server, if the address is correct