i\'ve tried to send email using this code..but an error occurred in smtp.Send(mail); messaging \"Failure sending mail\"
MailMessage mail = ne
You should be using the using statement when creating a new MailMessage, plus a few things you missed out like port number and enableSSL
using (MailMessage mail = new MailMessage())
{
mail.From = new MailAddress("from@gmail.com");
mail.To.Add(new MailAddress("to@yahoo.com"));
mail.Subject = "test sample";
mail.Body = @"thank you";
SmtpClient smtpServer = new SmtpClient("smtp.gmail.com");
smtpServer.Port = 587;
smtpServer.Credentials = new NetworkCredential("from@gmail.com", "password");
smtpServer.EnableSsl = true;
smtpServer.Send(mail);
}