System.Net.Mail.SmtpException:操作已超时。错误在asp.net中使用GoDaddy主机发送邮件code [英] System.Net.Mail.SmtpException: The operation has timed out. error in asp.net send mail code using godaddy hosting
问题描述
我使用以下code的和平使用GoDaddy主机发送邮件。
但它扔 System.Net.Mail.SmtpException:操作已超时
保护无效的sendmail()
{
VAR FROMADDRESS =frommailid@site.com;
//其中的电子邮件将被发送任何地址
VAR的toAddress =to@gmail.com;
//你的Gmail地址的密码
常量字符串fromPassword =输入mypassword;
//传递的价值观,使电子邮件酸盐显示
字符串主题=HI测试邮件;
绳体=来源:pro@e-hotelspro.com
// 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问题
<一个href=\"http://blogs.msdn.com/b/webdav_101/archive/2008/06/02/system-net-mail-with-ssl-to-authenticate-against-port-465.aspx\"相对=nofollow> 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 = "frommailid@site.com";
// any address where the email will be sending
var toAddress = "to@gmail.com";
//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: pro@e-hotelspro.com";
// 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!