Hello all,
I'm using this code to send an email via smtp in VB 2008:
This has had me stumped for the last week, but I think I got a little closer to atleast identifying the problem when I took it home. Ok, the code above doesn't work when I'm at work for some reason. The exception message is: "Unable to connect to the remote server. ". Seems odd because I am simply using the internet to connect to my smtp server to send an email. When I'm at home, this works just fine.Code:Dim smtp As SmtpClient = New SmtpClient("mail.mydomain.org") Dim SMTPUserInfo As NetworkCredential = New NetworkCredential("[email protected]", "mypassword") Dim From As String = "[email protected]" smtp.UseDefaultCredentials = False smtp.Credentials = SMTPUserInfo 'create the mail message Dim mail As MailMessage = New MailMessage 'Set recipients mail.To.Add("[email protected]") 'set the addresses mail.From = New MailAddress(From) 'set the content mail.Subject = "Test email subject" mail.Body = "Test email body" smtp.Send(mail)
So my question is: what is stopping it from going through when I'm at work? If I atleast know that, I may be able to tell our network guys what it is so they can allow it to get out.
Thanks,
Strick


Reply With Quote
