TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Anand B
NA
1
2.7k
Server Error in '/' Application.
Sep 30 2014 6:49 AM
Error:
Transaction failed. The server response was: 5.7.1 <
[email protected]
>: Relay access denied
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 <
[email protected]
>: Relay access denied
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("<Html>");
strMBody.Append("<Head></Head>");
strMBody.Append("<body>");
strbody = " <table width='100%' border='0' cellspacing='1' cellingpadding='2'><tbody>";
strbody +=
"<tr> <td colspan='3' style='padding-left: 10px;font-family:Tahoma;font-size:14px'><br /> ";
strbody += ",<br /></td> </tr> ";
strbody +=
"</tbody></table> ";
strbody += "<tr><td colspan=\"3\"></td></tr>";
strbody += "<tr><td colspan=2>" + "<font face=Verdana size=2 color=red>" + strfooter +
"</font></td></tr>";
strbody += "<tr><td style=\"height: 21px\"></td></tr>";
strbody += "</table>";
strMBody.Append(strbody);
strMBody.Append("</body>");
strMBody.Append("</Html>");
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:
<appsettings>
<add key="localserver" value="smtp.testing.com" />
</appsettings>
Please give some other ieda...
Reply
Answers (
1
)
Text boxes
print command on button