很奇怪的一个问题
用c#写了一个发mail的:提示:
Unhandled Exception: System.Net.Mail.SmtpException: Failure sending mail. ---> S
ystem.Net.WebException: Unable to connect to the remote server ---> System.Net.S
ockets.SocketException: 由于连接方在一段时间后没有正确答复或连接的主机没有反应,
连接尝试失败。
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddre
ss socketAddress)
at System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Sock
et 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 ow
ner, 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 ConsoleSmtp.Program.SendSMTPEMail(String strBody)
at ConsoleSmtp.Program.Main(String[] args)
操作系统为2003 server
我尝试用telnet连接smtp服务器,outlook也没办法收信
有几个win2003服务器是这样的,有的会,有的不会
smtp服务器是正常的,端口也都没关
Socket连接需要开什么端口么?(本机的防火墙都是全开的)