Jac*_*amm 5 c# asp.net email ssl
当我尝试在我的新GoDaddy电子邮件地址上使用SSL发送STMP电子邮件时,它不起作用.我收到一条错误消息说Unable to read data from the transport connection: net_io_connectionclosed.
以下是服务器的电子邮件设置:
这是我的web.config中包含电子邮件服务器信息的片段:
<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>
Run Code Online (Sandbox Code Playgroud)
这是发送电子邮件的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);
}
Run Code Online (Sandbox Code Playgroud)
端口80,3535和25在没有SSL的情况下工作正常,但四者中没有一个使用 SSL.我甚至尝试使用SSL端口587,经过相当长的一段时间它才刚刚超时.
如何使用SSL发送这些电子邮件?