Hello Sir,
I am trying to send mail in asp.net c# by smtp but i am getting this error:
An attempt was made to access a socket in a way forbidden by its access permissions 74.125.68.109:587
MailMessage msg=new MailMessage();
msg.From=new MailAddress("Demo@gmail.com");
msg.To.Add("Demo@Demo.in");
msg.Subject = "Hello";
msg.Body = "Hello world this is my first mail from Asp.net";
msg.IsBodyHtml = true;
SmtpClient client = new SmtpClient();
client.Host = "smtp.gmail.com";
System.Net.NetworkCredential netcrd = new System.Net.NetworkCredential();
netcrd.UserName = "Demo@gmail.com";
netcrd.Password = "Demo";
client.UseDefaultCredentials = true;
client.Port = 587;
client.EnableSsl = true;
client.Send(msg);