While trying to send an e-mail using MailKit
and MimeKit
, I received the following error:
Unable to read data from the transport connection: A 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.
The vb.net code I'm using:
Dim mail As New MimeMessage()
mail.From.Add(New MailboxAddress("John DOE", "john.doe@hotmail.com"))
mail.To.Add(New MailboxAddress("Mary JANE", "mary.jane@yahoo.com"))
mail.Subject = "Hello!"
Dim sText As New TextPart("plain")
sText.SetText("UTF-8", "How are you Jane?")
mail.Body = sText
Using smtp = New SmtpClient()
smtp.LocalDomain = "XX.XXX.XX.XXX"
smtp.Connect("server33.somewebhosting.com", 465, False)
smtp.Authenticate("myusername@somewebhosting.com", "XXXXXXXXXXXXXX")
smtp.Send(mail)
smtp.Disconnect(True)
End Using
The time-out error occurs at this line:
smtp.Connect("server33.somewebhosting.com", 465, False)
The weird thing is that it works on my home computer, but not at work.
What do you think is the cause of the problem?