在发送邮件超时错误 [英] Time out Error in send mail
问题描述
我使用此代码尝试和发送电子邮件。几秒钟后,它显示了我的错误信息,声称该操作已超时。我怎样才能解决这个问题?
试
{从=新的MailAddress
MailAddress(来自@ yahoo.com,名,Encoding.UTF8);
MailAddress到=新MailAddress(to@yahoo.com);
消息MAILMESSAGE新= MAILMESSAGE(从,到);
message.Subject =测试;
message.SubjectEncoding = Encoding.UTF8;
message.Body =测试;
message.BodyEncoding = Encoding.UTF8;
SmtpClient客户端=新SmtpClient();
client.Host =smtp.mail.yahoo.com;
client.Port = 465;
client.EnableSsl = TRUE;
client.Credentials =新的NetworkCredential(example@yahoo.com,密码);
client.Send(消息);
MessageBox.Show(发送成功!);
}
赶上(SmtpException前)
{
MessageBox.Show(ex.ToString());
}
您确定您可以达到 smtp.mail.yahoo.com
端口 465
?听起来很像网络相关的问题。通常,当东西超时,这意味着它会尝试连接到服务器进行了一定的时间,他们将停止并给你一个错误。
一个简单的方法测试这是远程登录
到 smtp.mail.yahoo.com
端口 465
,看看它是否超时。您可以使用腻子
或内置的远程登录
-client在Windows中,如果你已经安装了它。
I use this code to try and send an email. After a few seconds, it shows me an error message claiming the operation has timed out. How can I resolve this issue?
try
{
MailAddress from = new MailAddress("from@yahoo.com", "name", Encoding.UTF8);
MailAddress to = new MailAddress("to@yahoo.com");
MailMessage message = new MailMessage(from, to);
message.Subject = "Test";
message.SubjectEncoding = Encoding.UTF8;
message.Body = "Test";
message.BodyEncoding = Encoding.UTF8;
SmtpClient client = new SmtpClient();
client.Host = "smtp.mail.yahoo.com";
client.Port = 465;
client.EnableSsl = true;
client.Credentials = new NetworkCredential("example@yahoo.com", "Password");
client.Send(message);
MessageBox.Show("sending Successfully!!!");
}
catch (SmtpException ex)
{
MessageBox.Show(ex.ToString());
}
Are you sure that you can reach smtp.mail.yahoo.com
on port 465
? Sounds pretty much like a network related issue. Generally when something times out, it means that it tries to connect to the server for a certain amount of time and them stops and gives you an error.
One easy way to test this is to telnet
to smtp.mail.yahoo.com
on port 465
and see if it times out. You can use Putty
or the built in telnet
-client in windows, if you have it installed.
这篇关于在发送邮件超时错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!