This is the code that i have used for sending an E- mail: But the E-mail sending is getting failed every time plz give your valuable suggestions to solve this problem it's Urgent thanxx.....
MailMessage mail = new MailMessage();
mail.To.Add("yash.work19@gmail.com");
mail.From = new MailAddress("yshshkl@gmail.com");
mail.Subject = "hello";
mail.Body = "good one";
mail.IsBodyHtml = true;
SmtpClient smtp = new SmtpClient();
smtp.Host = "smtp.gmail.com"; //Or Your SMTP Server Address
smtp.Port = 465; //also tried 587
smtp.Credentials = new System.Net.NetworkCredential
("yshshkl@gmail.com", "***********"); //my id and password
smtp.EnableSsl = false;
smtp.Send(mail);
Response.Write("<script language='javascript'>alert('MAIL SENT');</script>");