发送邮件错误超时 [英] send mail error time out
本文介绍了发送邮件错误超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
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 = "ssl://181.40.105.33";
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());
}
推荐答案
我认为 digimanus 是正确的:主机不能为"ssl".我不认为这样的 URI方案以众所周知的( IANA 已注册)方案;请参阅:
http://en.wikipedia.org/wiki/URI_scheme#Official_IANA-registered_schemes [ ^ ].
—SA
I think digimanus is right: a host cannot be "ssl". I don''t think such URI Scheme exists as a well-known (IANA-registered) scheme; please see:
http://en.wikipedia.org/wiki/URI_scheme#Official_IANA-registered_schemes[^].
—SA
Host属性不能像您对"ssl://"所做的那样指定协议.它需要一个可通过DNS解析的主机名或一个IP地址.不要在里面放任何东西.它看起来像是"smtp.myserver.com"或"123.23.54.67".
The Host property cannot have a protocol specified like you did with "ssl://". It requires either a host name, resolvable by DNS, or an IP address. Don''t put anything in there. It''s going to look like either "smtp.myserver.com" or "123.23.54.67".
这篇关于发送邮件错误超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文