I am using VB 2010 on a Windows 7 Home Premium PC. I can't get my my smtp code to send an email out. It always comes back with the error:

"The operation has timed out"

I have both a Google Mail account and a Sky Mail account both of which use the same port but can't get either to work. I have checked my firewall and the smtp port 465 is allowed and I can see the process going through the firewall.

I know the mail works fine as I am using Windows Live Mail which sends and receives no problem. The code I am using is below:

Private Sub btnAddAmount_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAddAmount.Click
Dim message As New MailMessage
With message
.From = New MailAddress("myemail@sky.com")
.Subject = "TEST FORM PROG"
.Body = "HI THERE"
End With
Dim emailClient As New SmtpClient("smtp.tools.sky.com")
With emailClient
.EnableSsl = True
.Port = "465"
.Credentials = New Net.NetworkCredential("johnsmith@sky.com", "johnsmith")
Catch ex As Exception
End Try
End With
End Sub

Any help would be great

7 Years
Discussion Span
Last Post by JohnBo

Turns out that Sky have two smtp ports the other being 587. Popped this in and it works fine :-)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.