2016-07-25 1584 views
0

方案1: 通過使用合適的主機上的網站提交的電子郵件的形式發送郵件(遠程登錄工作正常,在端口25)正常工作我們本地系統上(其中代碼是完全一樣的)和我們發送的次數一樣多(不管連續提交的時間間隔是多少)。在提交表格時,我們會在提及的電子郵件地址中回覆回覆。System.Net.Mail.SmtpException:發送郵件失敗 - SMTP問題

方案2: 但是,當我們提交關於服務器的形式,它發送郵件成功第1次和我們得到的響應返回給使用的電子郵件地址。 當我們嘗試第二次提交表單時,如果在2分鐘30秒的間隔(已驗證但未確定其配置位置)之前嘗試失敗,並且如果我們嘗試在2分鐘後提交表單,則失敗30秒。

在服務器上,這是日誌,我們得到:

System.Net.Mail.SmtpException: Failure sending mail. ---> System.Net.WebException: 
Unable to connect to the remote server ---> System.Net.Sockets.SocketException: 

    A connection attempt failed because the connected party did not 
    properly respond after a period of time, or established connection 
    failed because connected host has failed to respond <SMTP server IP>:25 

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, Exception& exception) 
--- End of inner exception stack trace --- 
at System.Net.ServicePoint.GetConnection(PooledStream PooledStream, Object owner, Boolean 
async, IPAddress& address, Socket& abortSocket, Socket& abortSocket6) 
at System.Net.PooledStream.Activate(Object owningObject, Boolean async, GeneralAsyncDelegate 
asyncCallback) 
at System.Net.ConnectionPool.GetConnection(Object owningObject, GeneralAsyncDelegate 
asyncCallback, Int32 creationTimeout) 
at System.Net.Mail.SmtpConnection.GetConnection(ServicePoint servicePoint) 
at System.Net.Mail.SmtpClient.Send(MailMessage message) 
--- End of inner exception stack trace --- 

任何一個可以請解釋一下其中可能出現的問題?

非常感謝!

回答

0

好吧,這裏有個問題: 我的實例在AWS中託管,Amazon Elastic Compute Cloud(Amazon EC2)默認通過端口25限制電子郵件流量。

爲避免通過EC2的SMTP端點發送電子郵件時出現超時,請使用不同的端口(587或2587)。或者,我們需要填寫請求亞馬遜刪除電子郵件發送限制,以刪除油門。

更多的信息在:https://docs.aws.amazon.com/ses/latest/DeveloperGuide/smtp-connect.html