shahjagat
asked on
No connection could be made because the target machine actively refused it ipadd:port at system.Net.sockets.Socket.doConnect
Hi,
I am writing code to send an email whenever my application has an unhandled error.
With this same code i could get it runnign on a gmail smtp server.
However, when i replaced these values wit hvalues for my smtp host, i am gettin the following error. Why am i getting this error?
I am getting the following error.System.Net.Mail.smtp Exception: Failure sending Mail.----->System.Net.WebE xception:U nable to connect to remote server---->System.Net.Sock ets.socket Exception: No connection could be made because the target machine actively refused it ipadd:port at system.Net.sockets.Socket. doConnect
Here is my code.
I am writing code to send an email whenever my application has an unhandled error.
With this same code i could get it runnign on a gmail smtp server.
However, when i replaced these values wit hvalues for my smtp host, i am gettin the following error. Why am i getting this error?
I am getting the following error.System.Net.Mail.smtp
Here is my code.
Private Sub EmailTest(ByVal errorMsg As String)
Dim SmtpServer As New SmtpClient()
SmtpServer.Credentials = New Net.NetworkCredential("me@tremail.com", "test123")
SmtpServer.Port = 22
SmtpServer.Host = "smtp.myhost.com"
SmtpServer.EnableSsl = True
Dim mail As New MailMessage()
Try
mail.From = New MailAddress("me@tremail.com", "Web Developers", System.Text.Encoding.UTF8)
mail.To.Add("target@tremail.com")
mail.Subject = "Error Messages in Application"
mail.Body = errorMsg
SmtpServer.Send(mail)
Catch ex As Exception
MsgBox(ex.ToString())
End Try
End Sub
look like your firewall is blocking the port your trying to connect to
This could be a firewall issue, it could also be a port issue. If the server is not setup for anonymous relay, it may be expecting connections on an SSL port. Do you have access to the server configuration, and what mail system is it running?
ASKER
Hi sdrouins and ladarling,
I am getting this issue now.
System.Security.Authentica tion.Authe nticationE xception:T he Remote Certificate is Invalid According tothe validation procedure.
Thanks
I am getting this issue now.
System.Security.Authentica
Thanks
ASKER
ladarling:
The server is already set up for anonymous relay i guess as we have our outlook conencted to it.
what mail system is it running? - I am not sure what you mean by this.
Thanks
The server is already set up for anonymous relay i guess as we have our outlook conencted to it.
what mail system is it running? - I am not sure what you mean by this.
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If you are -not- interacting with a Microsoft Exchange email server, you need to verify the SSL and Relay ports for your provider and investigate what kind of authentication is necessary (if it requires SSL, for example). If this is a third party server, you will most likely have to authenticate. Try using your code again, but setting
SmtpServer.UseDefaultCrede ntials = False
SmtpServer.UseDefaultCrede
ASKER
I am working on that - Have to contact them.
ASKER
I am not using a microsft Exchange email server. We are using a 3rd party server.
ASKER
Hi ladarling,
when i changed the following from true to false, i am getting the mails.
SmtpServer.EnableSsl = False
Thanks
when i changed the following from true to false, i am getting the mails.
SmtpServer.EnableSsl = False
Thanks
ASKER
Hi , I do not see Mark As Answer buttons.
Please award points to ladarling - Comment ID: 33639661
Thanks
Please award points to ladarling - Comment ID: 33639661
Thanks