我正在尝试使用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;
}
答案 0 :(得分:1)
您的ISP可能阻止了端口25上的出站连接。
尝试端口587。