Hi
can we use gmail smtp in live website to send mail(feedback) from contactus form to the owner of the website, is it possible?
mail is send to the desire email id from local host from feedback form.
but problem occur when the same project uploaded to the live web server.
on clicking the submit button in the feedback form nothing happen.
what and where is the problem i can't get that?
because this application behave normal at local-host.
please guide me regarding this problem.
this line is appended with the url while clicking on submit button.
__EVENTTARGET=&__EVENTARGUMENT=&__VIEWSTATE=%2FwEPDwUKMTk2Njc5ODE2N2RkEGPdgAflCjv7N%2Fj8z04OHUSWDag%3D&__EVENTVALIDATION=%2FwEWBgLzi4feDwK0w7i7DQK9w4QnAqHo7y4C9oCMmQwCro6e7AMCSNU4FMIyaDwIGsIYTXrxUJrXnQ%3D%3D&ctl00%24ContentPlaceHolder1%24txtName=balwant&ctl00%24ContentPlaceHolder1%24txtMail=balwant.mnd%40gmail.com&ctl00%24ContentPlaceHolder1%24txtFeed=testing&ctl00%24ContentPlaceHolder1%24btsubmit=Submit
my code for sending email is as follow:
protected void btSubmit_Click(object sender, EventArgs e)
{
try
{
SmtpClient smtpClient = new SmtpClient();
MailMessage objMail = new MailMessage();
MailAddress objMail_fromaddress = new MailAddress(txtMail.Text);
MailAddress objMail_toaddress = new MailAddress("mymail@gmail.com");
objMail.IsBodyHtml = true;
objMail.From = objMail_fromaddress;
objMail.To.Add(objMail_toaddress);
objMail.Subject = "Feedback from" + txtName.Text + " to us from Contact us Form";
objMail.Body = "Message from" + txtName.Text + "as comments:-" + txtComments.Text + "<br><br><br>" + "Address:" + txtAddress.Text + "<br>Mobile no:" + txtTel.Text;
objMail.Priority = MailPriority.High;
smtpClient.Host = "smtp.gmail.com";
smtpClient.Port = 587
smtpClient.Credentials = new System.Net.NetworkCredential("mymail@gmail.com", "1239807643");
smtpClient.EnableSsl = true;
smtpClient.Send(objMail);
Label1.Visible = true;
Label1.Text = "your feedback is submitted successfully.";
}
catch (Exception ex)
{
Label1.Visible = true;
Label1.Text = "something went wrong!, Please Try Again." + ex.Message;
}