Hi, try the following code hope it helps
protected void Page_Load(object sender, EventArgs e)
{
Send("receiver@host.com", "Test Email", "Hello", false);
}
public void Send(string _to, string _subject, string _body, bool isHtml)
{
MailMessage mm = new MailMessage();
mm.From = new MailAddress("mygmailacc@gmail.com");
mm.To.Add(new MailAddress(_to));
mm.Subject = _subject;
mm.Body = _body;
mm.IsBodyHtml = isHtml;
SmtpClient smtp = new SmtpClient();
smtp.Host = "smtp.gmail.com";
smtp.EnableSsl = true;
System.Net.NetworkCredential NetworkCred = new System.Net.NetworkCredential();
NetworkCred.UserName = "mygmailacc@gmail.com";
NetworkCred.Password = "mypassword";
smtp.Credentials = NetworkCred;
smtp.Port = 587;
smtp.Send(mm);
}