When a data is inserted into two different tables, a confirmation email should be send to the client. below is the code which i am using for sending the email.Please reply asap.
string consstring = ConfigurationManager.ConnectionStrings["connstring"].ConnectionString;
string s2 = "insert into Enquiry_Form values('" + name.Text +
"','" + countrycode+
"','" + mobile.Text+
"','" + email.Text +
"','" + city.Text +
"','" + message.Text + "')";
con =
new SqlConnection(consstring);
con.Open();
SqlCommand cmd;
cmd =
new SqlCommand(s2, con);
cmd.ExecuteNonQuery();
MailMessage msg = new MailMessage();
msg.Subject =
"Enquiry";
msg.From =
new MailAddress("sender email id");
msg.To.Add("receiver email id");
SmtpClient smp = new SmtpClient("smtp.gmail.com");
smp.Port = 587;
smp.Credentials =
new NetworkCredential("sender email id", "password");
smp.Send(msg);