Why does this timeout?
Dim s As New SmtpClient
s.Host = "smtp.gmail.com"
s.Port = 465
s.EnableSsl = True
s.Timeout = 5000
s.Credentials = New NetworkCredential("email@example.com", "mypassword")
Dim m As New MailMessage
m.From = New MailAddress("firstname.lastname@example.org")
m.Body = "Test Message"
m.Subject = "Test Subject"
Edit: You might need to add the following line:
s.UseDefaultCredentials = False before the line starting with
Do you have a firewall or some kind of anti-virus program running that might be blocking the connections?
A good place to start is to just do a simple connect from the command line.
telnet smtp.gmail.com 465
Note, depending on Windows version you might have to enable the telnet client first, see this link for details.