Try below code to send mail using gmail.
public string senMail(string emailId, string MailBody)
{
try
{
MailMessage mail = new MailMessage();
SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com");
mail.From = new MailAddress("abc@gmail.com");
mail.To.Add(emailId);
mail.Subject = "Email Subject";
mail.Body = mailBody;
SmtpServer.Port = 587;
SmtpServer.Credentials = new System.Net.NetworkCredential("abc@gmail.com", "abc152wte.7");
SmtpServer.EnableSsl = true;
SmtpServer.Send(mail);
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
return "";
}