namespace System.net.mail;
you have to write this code when you click the button you want to send mail that button click event.
string s1="m.kalaingar@gmail.com";
string s2 = TextBox1.Text;
string s3 = TextBox2.Text;
string body = "dfhfhkjsdhgfjksdfhkjsfgjksfjksdhfsdfaskjfsdjkfh";
MailMessage mail = new MailMessage();
mail.From = new MailAddress(s1);
mail.To.Add(s2);
mail.Subject = s3;
mail.Body = body;
mail.IsBodyHtml = true;
mail.Priority = MailPriority.Normal;
SmtpClient smtp = new SmtpClient();
smtp.Send(mail);
Response.Write("your message send successfully");
you have to add this code to your webconfig
<system.net>
<mailSettings>
<smtp from="m.kalaingar@gmail.com">
<network host="smtp.gmail.com" port="465" username="yourgmailid" password="yourpassword">