using (MailMessage mm = new MailMessage(fromEmail, toEmail))
{
mm.Subject = txtSubject.Text;
mm.Body = txtBody.Text;
mm.IsBodyHtml = false;
SmtpClient smtp = new SmtpClient();
smtp.Host = "smtp.gmail.com";
smtp.EnableSsl = true;
NetworkCredential NetworkCred = new NetworkCredential(fromEmail, password);
smtp.UseDefaultCredentials = true;
smtp.Credentials = NetworkCred;
smtp.Port = 587;
smtp.Send(mm);
}
Try this