this method works fine
public static Boolean SendingMail(string From, string To, string Subject, string Body)
{
try
{
MailMessage m = new MailMessage("Test<sender@gmail.com>", To);
m.Subject = Subject;
m.Body = Body;
m.IsBodyHtml = true;
m.From = new MailAddress(From);
m.To.Add(new MailAddress(To));
SmtpClient smtp = new SmtpClient();
smtp.Host = "mail.google.com";
NetworkCredential authinfo = new NetworkCredential("test@gmail.com", "te1234");
smtp.UseDefaultCredentials = false;
smtp.Credentials = authinfo;
smtp.Send(m);
return true;
}
catch (Exception ex)
{
return false;
}
}