Click here to Skip to main content
15,897,360 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim s As New SmtpClient
s.Host = "smtp.gmail.com"
s.Port = 25
s.EnableSsl = True
s.Timeout = 1
s.Credentials = New NetworkCredential("projectpid021@gmail.com", "password")

Dim m As New MailMessage
m.To.Add("a.abukhiran_2011@hotmail.com")
m.From = New MailAddress("projectpid021@gmail.com")
m.Subject = "ahmed"
m.Body = "ahmed"
s.Send(m)
Label6.Text = "ahmed"
End Sub
Posted

1 solution

25 is not the SSL port, its 587

And you have the timeout set to 1, which is 1 MILLISECOND! Of course its going to time out, it doesn't have enough time to make it down the wire.
 
Share this answer
 
v2
Comments
Sergey Alexandrovich Kryukov 24-Aug-13 0:33am    
Ha-ha, 5ed... :-)
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900