While working with Email sending in C#.NET in visual studio 2008 i got the below error
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 74.125.53.108:25
But the same code was working fine in some other PC but when i am testing today it gives me error in Send()
method... Also my network connection is good where i am testing the email code..
Below is my email code
MailMessage mail = new MailMessage();
mail.To.Add(to);
mail.From = new MailAddress(from);
mail.Subject = subject;
mail.Body = body;
mail.IsBodyHtml = true;
SmtpClient smtp = new SmtpClient();
smtp.Host = "smtp.gmail.com";
smtp.Credentials = new System.Net.NetworkCredential("[email protected]",
"MyPassword");
smtp.EnableSsl = true;
smtp.Send(mail);
What could be the reasons for such error..???