来自 WebException 的 SmtpException:无法连接到远程服务器

发布于 2024-12-15 18:11:55 字数 1518 浏览 0 评论 0原文

我正在尝试使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

暮凉 2024-12-22 18:11:55

从这条消息

尝试对无法访问的网络 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

红墙和绿瓦 2024-12-22 18:11:55

该消息告诉我您的 Web 服务器在连接到 SMTP 服务器时出现问题。您确定 SMTP 地址正确吗?

请记住,某些 SMTP 服务器需要登录。

此外,如果您使用不同的 IPS,某些 SMTP 服务器将不允许您连接。

我会将 SMTP 更改为您的 ISP 所拥有的 SMTP。
您可以尝试使用Telnet连接到SMTP来检查您的连接

telnet YourSmtpAddress 25

The message tells me that your webserver has problems connectiong to your SMTP server. Are you sure the SMTP address is right?

Remember that some SMTP-servers need logon

Also some SMTP servers will not let you connect if your use a different IPS

I would change the SMTP to the one your ISP has.
You can try to connect to the SMTP with Telnet to check your connection

telnet YourSmtpAddress 25
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文