我已经用C#编写了一个简单的程序来发送邮件通知。它在Windows 7上运行良好,但在Server 2008上运行良好。Windows Server2008:打开smtp端口不够发送邮件?
我已经阅读了一些内容,但看不到什么让我无法发送邮件。我已经打开了端口587(用于Gmail的SSL端口)传出和传入(TCP),但仍然没有运气。我甚至为整个程序打开了防火墙。 Windows Server中是否有特定的设置,我应该知道?
*编辑 - 除Windows以外没有其他防火墙。
堆栈跟踪:
System.Net.Mail.SmtpException: Failure sending mail. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full 74.125..:587 at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) 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 ---
编辑:我发现我的回答是:问题是无关的Windows服务器。这是因为它无法连接到我的数据库。傻我。之前当无法连接到数据库时,出现连接错误,但现在我只能看到奇怪的错误消息;其中之一张贴在这里。
感谢您的帮助!很高兴得到如此迅速的帮助。第一
根据[其常见问题](http://mail.google.com/support/bin/answer.py?answer=13287),gmail的SMTP SSL端口是'465'('587'是TLS端口) 。也许这就是问题所在? – 2011-05-30 10:48:24
由于您将程序作为*普通*应用程序运行,或者作为服务运行? – Oliver 2011-05-30 11:58:15
尝试发送时是否收到代码错误?如果是这样,你可以包含堆栈跟踪吗? – 2011-05-30 20:59:44