try
{
MailMessage message = new MailMessage();
SmtpClient sc = new SmtpClient();
message.To.Add("info@syncretize.in");
message.Subject = "Contact";
message.IsBodyHtml = true;
message.From = new MailAddress("enquiryfromwebsite@tansensangeet.com");
sc.Host = "smtp.gmail.com";
sc.Port = 587;
sc.EnableSsl = true;
sc.UseDefaultCredentials = false;
sc.Credentials = new NetworkCredential("enquiryfromwebsite@tansensangeet.com", "parallels");
string htmlbody = "";
htmlbody = "<HTML>";
htmlbody = htmlbody + "<HEAD>";
htmlbody = htmlbody + "</HEAD>";
htmlbody = htmlbody + "<BODY>";
htmlbody = htmlbody + "<br>";
htmlbody = htmlbody + "Name: " + TextBox1.Text;
htmlbody = htmlbody + "<br>";
htmlbody = htmlbody + "Email From: " + TextBox3.Text;
htmlbody = htmlbody + "<br>";
htmlbody = htmlbody + "Mobile No.: " + TextBox2.Text;
htmlbody = htmlbody + "<br>";
htmlbody = htmlbody + "Message: " +TextBox4.Text;
htmlbody = htmlbody + "<br>";
htmlbody = htmlbody + "<br>";
htmlbody = htmlbody + "<br>";
htmlbody = htmlbody + "</BODY>";
htmlbody = htmlbody + "</HEAD>";
htmlbody = htmlbody + "</HTML>";
message.Body = htmlbody;
sc.Send(message);
TextBox1.Text = "";
TextBox2.Text = "";
TextBox3.Text = "";
TextBox4.Text = "";
Label14.Visible = true;
//Response.Write("<script>alert('Thank You for taking the time to Syncretize')</scrip>");
}
catch (Exception)
{
Label14.Visible=true;
Label14.Text = "Message Not Sent";
}
}
{
MailMessage message = new MailMessage();
SmtpClient sc = new SmtpClient();
message.To.Add("info@syncretize.in");
message.Subject = "Contact";
message.IsBodyHtml = true;
message.From = new MailAddress("enquiryfromwebsite@tansensangeet.com");
sc.Host = "smtp.gmail.com";
sc.Port = 587;
sc.EnableSsl = true;
sc.UseDefaultCredentials = false;
sc.Credentials = new NetworkCredential("enquiryfromwebsite@tansensangeet.com", "parallels");
string htmlbody = "";
htmlbody = "<HTML>";
htmlbody = htmlbody + "<HEAD>";
htmlbody = htmlbody + "</HEAD>";
htmlbody = htmlbody + "<BODY>";
htmlbody = htmlbody + "<br>";
htmlbody = htmlbody + "Name: " + TextBox1.Text;
htmlbody = htmlbody + "<br>";
htmlbody = htmlbody + "Email From: " + TextBox3.Text;
htmlbody = htmlbody + "<br>";
htmlbody = htmlbody + "Mobile No.: " + TextBox2.Text;
htmlbody = htmlbody + "<br>";
htmlbody = htmlbody + "Message: " +TextBox4.Text;
htmlbody = htmlbody + "<br>";
htmlbody = htmlbody + "<br>";
htmlbody = htmlbody + "<br>";
htmlbody = htmlbody + "</BODY>";
htmlbody = htmlbody + "</HEAD>";
htmlbody = htmlbody + "</HTML>";
message.Body = htmlbody;
sc.Send(message);
TextBox1.Text = "";
TextBox2.Text = "";
TextBox3.Text = "";
TextBox4.Text = "";
Label14.Visible = true;
//Response.Write("<script>alert('Thank You for taking the time to Syncretize')</scrip>");
}
catch (Exception)
{
Label14.Visible=true;
Label14.Text = "Message Not Sent";
}
}
No comments:
Post a Comment