다음 코드는 고객에게 전자 메일을 보낼 수없고 예외를 throw하지 않습니다. 코드는 이메일이나 예외를 보내지 않지만 실행되었습니다. 나는 asp.net에 관해 완전히 새로운 것입니다. 어떤 사람들은 문제를 해결하는 방법을 도울 수 있습니다.asp.net에서 mailmessage를 보낼 수 없습니다.
코드 :
try
{
String userName = "ramesh";
String passWord = "123456";
String sendr = "[email protected]";
String recer = "[email protected]";
String subject = "Comformation ";
String body = "Dear Customer";
MailMessage msgMail = new MailMessage(sendr, recer, subject, body);
int PortNumber = 25;
SmtpClient smtp = new SmtpClient("smtp.test.com", PortNumber);
msgMail.IsBodyHtml = true;
smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
smtp.Credentials = new System.Net.NetworkCredential(userName, passWord);
smtp.Send(msgMail);
MsgLP.Text = "Emailed to Customer..";
LogInLink.Visible = true;
}
catch (Exception ex){
AuditLog.LogError("ErrorE-mail " + ex.Message);
}
스팸을 보았습니까? 메일 서버에 보안 설정이 있습니까? – Mairaj
메일 서버의 스팸 보안 설정을 확인하는 방법을 알려주십시오. – Prathyush
이메일을 보내지 않으면 어떻게 알 수 있습니까? 나는 당신의 코드가 잘 작동한다고 제안하지만, SMTP 서버는 이메일을 전달하지 않는다. –