我有一个域名,我已经上传了我的ASP.NET MVC网站,也使用了我创建了一些邮件帐户的cpanel。现在当我试图发送电子邮件时,我收到了错误。看看我的代码::
MailMessage message = new MailMessage();
message.From = new MailAddress("webmail-ac@domain.com");
message.To.Add("example@hotmail.com");
message.Subject = "Welcome.";
message.IsBodyHtml = true;
message.Body = "this is my test email body";
SmtpClient smtpClient = new SmtpClient();
smtpClient.UseDefaultCredentials = true;
smtpClient.Host = "Domain-IP";
smtpClient.Port = 25;
smtpClient.EnableSsl = true;
smtpClient.Credentials = new System.Net.NetworkCredential("webmail-ac@domain.com", "Password");
ServicePointManager.ServerCertificateValidationCallback =
delegate(object s, X509Certificate certificate,
X509Chain chain, SslPolicyErrors sslPolicyErrors)
{ return true; };
smtpClient.Send(message);
但我得到的描述错误::
服务不可用,关闭传输通道。服务器响应为:无法连接到SMTP服务器[domain-ip]([domain-ip]:25),连接错误10060。
有谁可以帮我解决这个问题?