2016-07-25 1585 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