今天做了个找回密码的功能,发送邮箱时不能成功。在本地行,放到服务器就不行了,端口和防火墙都已经都没问题。System.Net.Mail.SmtpException: 发送邮件失败。 ---> System.Net.WebException: 无法连接到远程服务器 ---> System.Net.Sockets.SocketException: 由于目标机器积极拒绝,无法连接。 123.125.50.134:25 在 System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) 在 System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP) 在 System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception) --- 内部异常堆栈跟踪的结尾 --- 在 System.Net.ServicePoint.GetConnection(PooledStream PooledStream, Object owner, Boolean async, IPAddress& address, Socket& abortSocket, Socket& abortSocket6, Int32 timeout) 在 System.Net.PooledStream.Activate(Object owningObject, Boolean async, Int32 timeout, GeneralAsyncDelegate asyncCallback) 在 System.Net.PooledStream.Activate(Object owningObject, GeneralAsyncDelegate asyncCallback) 在 System.Net.ConnectionPool.GetConnection(Object owningObject, GeneralAsyncDelegate asyncCallback, Int32 creationTimeout) 在 System.Net.Mail.SmtpConnection.GetConnection(String host, Int32 port) 在 System.Net.Mail.SmtpTransport.GetConnection(String host, Int32 port) 在 System.Net.Mail.SmtpClient.GetConnection() 在 System.Net.Mail.SmtpClient.Send(MailMessage message) --- 内部异常堆栈跟踪的结尾 --- 在 System.Net.Mail.SmtpClient.Send(MailMessage message) 在 MailControl.SendMail(String FromSMTP, String FromEmail, String FromPassword, String ToEmail, String Subject, String Body) 位置 e:\easyuserver\es10100\web\index\App_Code\MailControl.cs:行号 165
如果可以 再开防火墙 再开端口