记一次控制台发邮件正常,但是部署到iis上发邮件有一部分邮件能够正常发送,有一部分邮件一直提示:Unable to read data from the transport connection: net_io_connectionclosed. 错误
发件服务器:
smtp.office365.com
解决方案 :
修改传输协议 为 SecurityProtocolType.Tls12
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
参考:
Office 365 SMTP starts firing net_io_connectionclosed
TLS 1.2 not negotiated in .NET 4.7 without explicit ServicePointManager.SecurityProtocol call