protected void SendMail()
{
var fromAddress = "google@gmail.com";
var toAddress = "info@gmail.com";
const string fromPassword = "123456789";
string subject = TextBox3.Text.ToString();
string body = "From: " + txtname.Text + "\n";
body += "Email: " + txtemail.Text + "\n";
body += "Mobile: " + txtsubject.Text + "\n";
body += "Message: \n" + txtmsg.Text + "\n";
var smtp = new System.Net.Mail.SmtpClient();
{
smtp.Host = "smtp.gmail.com";
smtp.Port = 587;
smtp.EnableSsl = true;
smtp.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
smtp.Credentials = new NetworkCredential(fromAddress, fromPassword);
smtp.Timeout = 20000;
}
smtp.Send(fromAddress, toAddress, subject, body);
}