我已經用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