![](/img/trans.png)
[英]System.Net.Mail.SmtpException: The operation has timed out / Unable to connect server
[英]system.net.mail.smtpException :Unable to connect to the remote server?
我正在嘗試使用Kinghost SMTP發送電子郵件,但出現以下錯誤:
system.net.mail.smtpException : failure sending mail
有什么想法嗎?
private bool SendEmail( string sendto, string sendfrom, string subject, string body )
{
bool status = false;
try
{
msg.To.Clear();
clint.Host = "smtp.kinghost.net";
clint.Port = 25;
clint.UseDefaultCredentials = false;
clint.Credentials = smtpCrede;
clint.EnableSsl = true;
MailAddress to = new MailAddress(sendto);
MailAddress from = new MailAddress(sendfrom);
msg.Subject = subject;
msg.Body = body;
msg.From = from;
msg.To.Add(to);
clint.Send(msg);
status = true;
}
catch ( Exception ex )
{
MessageBox.Show(ex.ToString());
}
return status;
}
您的ISP可能阻止了端口25上的出站連接。
嘗試端口587。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.