本文介绍了System.Net.Mail.SmtpException:操作已超时。错误在asp.net中使用GoDaddy主机发送邮件code的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用以下code的和平使用GoDaddy主机发送邮件。
但它扔 System.Net.Mail.SmtpException:操作已超时
保护无效的sendmail()
{
VAR FROMADDRESS [email protected];
//其中的电子邮件将被发送任何地址
VAR的toAddress [email protected];
//你的Gmail地址的密码
常量字符串fromPassword =输入mypassword;
//传递的价值观,使电子邮件酸盐显示
字符串主题=HI测试邮件;
绳体=来源:[email protected]
// SMTP设置
VAR SMTP =新System.Net.Mail.SmtpClient();
{
//smtp.Host =relay-hosting.secureserver.net;
smtp.Host =smtpout.secureserver.net;
smtp.Port = 80;
smtp.EnableSsl = TRUE;
smtp.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
smtp.Credentials =新的NetworkCredential(FROMADDRESS,fromPassword);
smtp.Timeout = 20000;
}
//将值传递给SMTP对象
smtp.Send(FROMADDRESS,的toAddress,主题,正文);
}
解决方案
我觉得这是System.Net.Mail著名SSL问题
System.Net.Mail使用SSL打击端口身份验证465
您应该使用一些外部的库或者等待微软有这个功能在框架发布
I am using following peace of code to send mail using godaddy hosting .
but its throw System.Net.Mail.SmtpException: The operation has timed out.
protected void sendmail()
{
var fromAddress = "[email protected]";
// any address where the email will be sending
var toAddress = "[email protected]";
//Password of your gmail address
const string fromPassword = "mypassword";
// Passing the values and make a email formate to display
string subject = "HI test mail ";
string body = "From: [email protected]";
// smtp settings
var smtp = new System.Net.Mail.SmtpClient();
{
//smtp.Host = "relay-hosting.secureserver.net";
smtp.Host = "smtpout.secureserver.net";
smtp.Port = 80;
smtp.EnableSsl = true;
smtp.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
smtp.Credentials = new NetworkCredential(fromAddress, fromPassword);
smtp.Timeout = 20000;
}
// Passing values to smtp object
smtp.Send(fromAddress, toAddress, subject, body);
}
解决方案
I think this is the famous SSL issue of System.Net.Mail
System.Net.Mail with SSL to authenticate against port 465
You should use some external library or wait until Microsoft include this features in a framework release
这篇关于System.Net.Mail.SmtpException:操作已超时。错误在asp.net中使用GoDaddy主机发送邮件code的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!