大约 30% 的时间发生 SMTPException

SMTPException happening about 30% of time

我有 asp.net 网页,在某些情况下会通过电子邮件通知用户。然而,大约 30% 的情况下,电子邮件未发送并抛出 SmtpException:

System.Net.Mail.SmtpException: Failure sending mail. ---> System.IO.IOException: Unable to read data from the transport connection: net_io_connectionclosed.

因为我一直在与这个错误作斗争,所以我设法提取了 SmtpStatusCode,上面写着:"General failure"。作为 smtp 服务器,我使用 mandrill 并设置:
<network host="smtp.mandrillapp.com" password="####" port="25" userName="####" enableSsl="false" />

谁能给我一个理由,为什么这个错误只发生 30%,而不是总是发生。我查看了关于 Whosebug 的其他问题,但它们涉及根本不起作用的情况。

如果您使用的是住宅互联网连接,您的 ISP 将通过阻止所有到端口 25.Try 的出站连接来阻止外发电子邮件发送,端口 25.Try 连接到本地电子邮件服务器 TCP/IP,或一个你自己的内部网络。

更新

正如您所询问的历史,这里是 blog 我提到它来回答您的问题

In 1982, the University of Southern California submitted a proposal to the Internet Engineering Task Force (IETF). Request For Comments (RFC) 821 was published, establishing port 25 as the default transmission channel for internet email. 30 years later, we still use port 25 as the primary means of transmitting email between two mail servers. A few RFCs have obsoleted the initial SMTP RFC, however, the basis for SMTP remains the same or similar.

In December of 1998, R. Gellens and J. Klensin submitted RFC 2476 in support of adding a new specification for internet email communications. The RFC proposed a split of the traditional message submission and message relay concept. The RFC defined that message submission should occur over port 587 to ensure new policy and security requirements don't interfere with the traditional relay traffic over message relay port 25.

那么为什么端口 25 在您的情况下不起作用?

It is traditionally blocked, by residential ISPs and Cloud Hosting Providers, to curb the amount of spam that is relayed from compromised computers or servers. Unless you're specifically managing a mail server, you should have no traffic traversing this port on your computer or server.

为什么 587 会起作用?

This is the default mail submission port. When a mail client or server is submitting an email to be routed by a proper mail server, it should always use this port.

All Mailgun customers should consider using this port as default, unless you're explicitly blocked by your upstream network or hosting provider. This port, coupled with TLS encryption, will ensure that email is submitted securely and following the guidelines set out by the IETF.