SMTP电子邮件:拒绝连接客户端主机:使用ASP.NET拒绝访问

时间:2019-07-19 04:00:00

标签: asp.net email smtp

使用ASP.NET发送电子邮件时出现问题。

这是我的代码:

MailMessage msgMail = new MailMessage();
msgMail.Body = "Testing Message";
msgMail.From = new MailAddress("info@kls.com");
msgMail.To.Add("tes@tes.co.id");
msgMail.Subject = "Test";
msgMail.IsBodyHtml = true;

SmtpClient smtp = new SmtpClient();
smtp.UseDefaultCredentials = false;
smtp.Host = "198.144.45.14";
smtp.Port = 587;
smtp.EnableSsl = true;

NetworkCredential crdntl = new NetworkCredential("info@kls.com","123456");

smtp.Credentials = crdntl;
smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
smtp.Send(msgMail);

This is the error that occurs enter image description here

有人可以改善我的代码吗?请

0 个答案:

没有答案