Transaction failed. The server response was: 5.7.1
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Net.Mail.SmtpException: Transaction failed. The server response was: 5.7.1
Code:
private void SendMail()
{
try
{
string toMailId = "[email protected]";
string fromMailId = "[email protected]";
string mailSubject = "test";
string strfooter = "Note: This is an auto generated email. Please do not reply.";
string strbody = "";
var message = new MailMessage();
message.To.Add(toMailId);
message.Subject = mailSubject;
message.From = new MailAddress(fromMailId, "test");
var strMBody = new StringBuilder();
strMBody.Append("");
strMBody.Append("");
strMBody.Append("");
strbody = "
"; strbody += ", |
strbody += "
strbody += "
"
strbody += "
strbody += "";
strMBody.Append(strbody);
strMBody.Append("");
strMBody.Append("");
strMBody.ToString();
message.Body = strMBody.ToString();
message.IsBodyHtml = true;
SmtpClient sc =
new SmtpClient(ConfigurationManager.AppSettings["localserver"].ToString(), 587);
sc.Send(message);
strbody = "";
}
catch (Exception ex)
{
throw ex;
}
}
web.config:
Please give some other ieda...
Abhishek KumarPosted Sep 30, 2014, 7:25 AM
Please try to check the port 587 you are using, seems issue with it.
Abhishek