使用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);
有人可以改善我的代码吗?请