Hi dear,
Check this solution.
private void MailSend()
{
try
{
MailMessage mail = new MailMessage();
SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com");
SmtpServer.Host = "smtp.gmail.com";
mail.From = new MailAddress("FromMailName@gamil.com");
mail.To.Add("ToMailName@gmail.com");
mail.Subject = "Test Mail";
mail.Body = "This is for testing SMTP mail from GMAIL";
SmtpServer.Port = 587;
SmtpServer.Credentials = new System.Net.NetworkCredential("ToMailName@gmail.com", "123456");
SmtpServer.EnableSsl = true;
SmtpServer.Send(mail);
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}