|
-
May 11th, 2009, 09:39 AM
#1
Thread Starter
Fanatic Member
Sending email issue
Hello all,
I'm using this code to send an email via smtp in VB 2008:
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)
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.
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|