Results 1 to 2 of 2

Thread: Sending email issue

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2004
    Posts
    541

    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

  2. #2
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,290

    Re: Sending email issue

    1. Check to make sure that dns can resolve.
    2. Check to make sure that firewall doesn't block that domain or smtp port used.
    Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
    - Abraham Lincoln -

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width