unable to sent the feedback .Check your smpt serverFailure sending mail.
my code is as follow
try
{
string filename = Server.MapPath("~/App_Data/FeedBack.txt");
string mailbody = System.IO.File.ReadAllText(filename);
mailbody = mailbody.Replace("##Name##", txtName.Text);
mailbody = mailbody.Replace("##Email##",txtEmail.Text);
mailbody = mailbody.Replace("##contact##",txtContact.Text);
mailbody = mailbody.Replace("##Commnect##",txtSuggestion.Text);
MailMessage myMessage = new MailMessage();
myMessage.Subject = "Responce from website";
myMessage.Body = mailbody;
myMessage.From = new MailAddress("[email protected]","Amit Kumar");
myMessage.To.Add(new MailAddress("[email protected]", "Amit Verma"));
SmtpClient mysmptclient = new SmtpClient("localhost");
mysmptclient.Host = "smtp.gmail.com";
mysmptclient.Port = 587;
mysmptclient.Credentials = new System.Net.NetworkCredential("[email protected]", "Myemailpassword");
mysmptclient.Send(myMessage);
formatTable.Visible = false;
lblMail.Text = "Your Feedback has been sent successfully";
lblMail.ForeColor = Color.Green;
}
catch(Exception expt)
{
lblMail.Text = "unable to sent the feedback .Check your smpt server"+expt.Message;
lblMail.ForeColor = Color.Red;
}
in web.confg file i have written

Posted Oct 1, 2013, 5:39 AM
Sanjeeb LenkaPosted Oct 1, 2013, 4:43 AM
Its not possible to share mail id in forum. its not allowed. i will suggest you copy your website from C drive to other drive and check.
Amit KumarPosted Oct 1, 2013, 3:55 AM
Sanjeeb LenkaPosted Oct 1, 2013, 3:42 AM
try to run visual studio Run as Administrator and check.
Amit KumarPosted Oct 1, 2013, 3:29 AM
Sunny SharmaPosted Oct 1, 2013, 3:13 AM
- In Windows Explorer, locate and select the folder C:\Users\AMIT.
- Right-click the folder, and then click Properties.
- In the Properties dialog box, click the Security tab.
- On the Security tab, examine the list of users. If the Network Service account is not listed, add it.
- In the Properties dialog box, click the Network Service user name, and in the Permissions for NETWORK SERVICE section, select the Read, Write, and Modify permissions. Click Apply, and then click OK.
try running the application if it works now.Amit KumarPosted Oct 1, 2013, 2:55 AM
Sunny SharmaPosted Oct 1, 2013, 2:44 AM
Amit KumarPosted Oct 1, 2013, 2:38 AM
Posted Oct 1, 2013, 2:26 AM
Check your firewall and antivirus settings, whether it is not blocking the external communication.
Temporarily disable antivirus, firewall and run your application to test it.
Amit KumarPosted Oct 1, 2013, 2:21 AM
Sanjeeb LenkaPosted Oct 1, 2013, 2:19 AM
Sunny SharmaPosted Oct 1, 2013, 2:11 AM
Amit KumarPosted Oct 1, 2013, 1:54 AM
Posted Oct 1, 2013, 1:50 AM
Amit KumarPosted Oct 1, 2013, 1:46 AM
Sunny SharmaPosted Oct 1, 2013, 1:41 AM
Code suggested by Muralidharan Sir should work perfectly and it's working, tested. I suggest you to put a breakpoint in your try block and navigate through the code to see which like of code is raising the error. I suspect you have an issue with reading the file.
Please let us know if it helps.
Amit KumarPosted Oct 1, 2013, 1:28 AM
Posted Oct 1, 2013, 1:26 AM
Amit KumarPosted Oct 1, 2013, 1:22 AM
unable to sent the feedback .Check your smpt serverFailure sending mail.
Posted Oct 1, 2013, 1:16 AM
http://www.c-sharpcorner.com/uploadfile/meetuchoudhary/sending-mails-with-attachments-using-gmail/
Please let me know, if it is not helping you !
Posted Oct 1, 2013, 1:14 AM
SmtpClient mysmptclient = new SmtpClient();
mysmptclient.EnableSsl = true;
Enabled SSL and used default constructor for smtpclient.