email problem (with gmail email)

i have a email problem in my program will someone with this problem i want to send a email with tls enabled and with credentials (example: username and password) but it gives me this error message: failure sending mail on general exception error and the first innner exception error is:system.net.webexception "unable to connect to the remote server". the second inner exception is: system.net.sockets.socketexception "connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond". heres my code can anyone help me:
Dim email As New MailMessage("[email protected]", "[email protected]", "Execution Manager Consumer Problem:" + TxtProblemName.Text + "Dont delete!", TxtProblemDesc.Text)
Dim client As New SmtpClient("smtp.google.com", 465)
client.DeliveryMethod = SmtpDeliveryMethod.Network
Dim credentials As Net.NetworkCredential = New Net.NetworkCredential("[email protected]", "computergeek")
client.UseDefaultCredentials = False
client.Credentials = credentials
client.EnableSsl = True

' The userState can be any object that allows your callback
' method to identify this send operation.
' For this example, the userToken is a string constant.
'Dim userstate As String = "test message1"
'client.SendAsync(email, userstate)
'Console.WriteLine("Sending message... press c to cancel mail. Press any other key to exit.")
client.Send(email)
thanks for any help again, jeffman
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories