【发布时间】:2017-08-31 15:47:57
【问题描述】:
当我尝试在我的新 GoDaddy 电子邮件地址上使用 SSL 在 ASP.NET 中发送 STMP 电子邮件时,它不起作用。我收到一条错误消息说Unable to read data from the transport connection: net_io_connectionclosed.
以下是服务器的电子邮件设置:
这是我的 web.config 中的 sn-p 以及电子邮件服务器信息:
<system.net>
<mailSettings>
<smtp from="no-reply@mysite.com" >
<network host="smtpout.secureserver.net" port="465" userName="no-reply@mysite.com" password="password123" enableSsl="true" />
</smtp>
</mailSettings>
</system.net>
这是发送电子邮件的 C# 代码。
MailMessage message = new MailMessage();
message.To.Add(new MailAddress(to));
message.Subject = "Message from " + inputModel.Name;
message.Body = body;
message.IsBodyHtml = true;
using (var smtp = new SmtpClient())
{
smtp.Send(message);
}
端口 80、3535 和 25 在没有 SSL 的情况下可以正常工作,但是这四个端口都不能在 SSL 的情况下工作。我什至用 SSL 尝试了 587 端口,但在很长一段时间后它就超时了。
如何让这些电子邮件使用 SSL 发送?
【问题讨论】: