Posted on: 7/30/2012 9:16:12 PM | Views : 1180

Hello,
I have developed a web application in ASP.Net which sends automatic emails to the users. Everything is working fine in web application. I am using the same code and SMTP server in Windows Forms application and I am getting below error.
System.Net.Mail.SmtpException: Failure sending mail. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: An attempt was made to access a socket in a way forbidden by its access permissions xx.xx.xx.xx:25
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP)
My Send Mail Code
Dim fromaddress As String = "from@test.com" Dim MyMailMessage As New MailMessage() MyMailMessage.From = New MailAddress(fromaddress) MyMailMessage.To.Add("test@test.com") MyMailMessage.Subject ...

Go to the complete details ...