i am getting an error
on shared hosting server but it worked fine on localhost
here is my code
using (MailMessage mail = new MailMessage())
{
mail.From = new MailAddress(emailFrom);
mail.To.Add(emailTo);
mail.Subject = subject;
mail.Body = body;
mail.IsBodyHtml = false;
message.Text = "Loading...";
SmtpClient smtp = new SmtpClient( "smtp.gmail.com", 587);
smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
smtp.Credentials = new System.Net.NetworkCredential("[email protected]", "password");
smtp.EnableSsl = true;
//smtp.UseDefaultCredentials = false;
smtp.Send(mail);
message.Text = "Message sent successfully....";
txtEmail.Text = "";
txtmsg.Text = "";
txtName.Text = "";
success.Visible = true;


Amit GuptaRank #190 · 12.8K reputationPosted Jan 27, 2018, 9:07 PM EST
Suraj KumarRank #353 · 7.1K reputationPosted Jan 27, 2018, 9:09 PM EST
Rahul Sharma195 reputationPosted Jan 28, 2018, 3:07 AM EST
Amit GuptaRank #190 · 12.8K reputationPosted Jan 28, 2018, 3:43 AM EST
Amit GuptaRank #190 · 12.8K reputationPosted Jan 28, 2018, 3:45 AM EST
Suraj KumarRank #353 · 7.1K reputationPosted Jan 28, 2018, 4:18 AM EST
Gautam ParmarRank #2,471 · 568 reputationPosted Jan 28, 2018, 5:01 AM EST