Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Mailing send error due to ... !!!

Mailing send error due to ... !!!

Scheduled Pinned Locked Moved Visual Basic
csharpcomhelpquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    John Kh
    wrote on last edited by
    #1

    Hello , I am using this code to send an E-mail from a Gmail account : Dim SmtpServer As New SmtpClient() SmtpServer.Credentials = New Net.NetworkCredential("xxx@gmail.com", "password") 'SmtpServer.Credentials = New Net.w SmtpServer.Port = 587 SmtpServer.Host = "smtp.gmail.com" SmtpServer.EnableSsl = True mail = New MailMessage() Dim addr() As String = TextBox1.Text.Split(",") Try mail.From = New MailAddress("bankersystem@gmail.com", "Web Developers", System.Text.Encoding.UTF8) Dim i As Byte For i = 0 To addr.Length - 1 mail.To.Add(addr(i)) Next mail.Subject = TextBox3.Text mail.Body = TextBox4.Text If ListBox1.Items.Count <> 0 Then For i = 0 To ListBox1.Items.Count - 1 mail.Attachments.Add(New Attachment(ListBox1.Items.Item(i))) Next End If mail.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure mail.ReplyTo = New MailAddress(TextBox1.Text) SmtpServer.Send(mail) Catch ex As Exception MsgBox(ex.ToString()) End Try When I use the broadband connection at home , all work fine . However when I use the wireless connection at uni , It gives me always an error that it cannot connect to host and cant send the message !!! Any idea ?! J ,

    F 1 Reply Last reply
    0
    • J John Kh

      Hello , I am using this code to send an E-mail from a Gmail account : Dim SmtpServer As New SmtpClient() SmtpServer.Credentials = New Net.NetworkCredential("xxx@gmail.com", "password") 'SmtpServer.Credentials = New Net.w SmtpServer.Port = 587 SmtpServer.Host = "smtp.gmail.com" SmtpServer.EnableSsl = True mail = New MailMessage() Dim addr() As String = TextBox1.Text.Split(",") Try mail.From = New MailAddress("bankersystem@gmail.com", "Web Developers", System.Text.Encoding.UTF8) Dim i As Byte For i = 0 To addr.Length - 1 mail.To.Add(addr(i)) Next mail.Subject = TextBox3.Text mail.Body = TextBox4.Text If ListBox1.Items.Count <> 0 Then For i = 0 To ListBox1.Items.Count - 1 mail.Attachments.Add(New Attachment(ListBox1.Items.Item(i))) Next End If mail.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure mail.ReplyTo = New MailAddress(TextBox1.Text) SmtpServer.Send(mail) Catch ex As Exception MsgBox(ex.ToString()) End Try When I use the broadband connection at home , all work fine . However when I use the wireless connection at uni , It gives me always an error that it cannot connect to host and cant send the message !!! Any idea ?! J ,

      F Offline
      F Offline
      Fu Manchu
      wrote on last edited by
      #2

      Hi, When you say it works at home? Alarm bell should be ringing here! if it works what are you doing differently at uni, i.e. are you using a wired connection at home and a wireless connection at uni etc... Many uni's have proxy servers and this could also be an issue - you need to take the uni out of the equation try it on a different wireless network and eliminate the problem down. To test your code try and a do a simple web request i.e get the html or a website,you can get the code off google, if it this in both places then this tells you you can acces the web your uni's proxy if not then its got to be your code, and you may have to pass up them credentials also. Andy

      J 1 Reply Last reply
      0
      • F Fu Manchu

        Hi, When you say it works at home? Alarm bell should be ringing here! if it works what are you doing differently at uni, i.e. are you using a wired connection at home and a wireless connection at uni etc... Many uni's have proxy servers and this could also be an issue - you need to take the uni out of the equation try it on a different wireless network and eliminate the problem down. To test your code try and a do a simple web request i.e get the html or a website,you can get the code off google, if it this in both places then this tells you you can acces the web your uni's proxy if not then its got to be your code, and you may have to pass up them credentials also. Andy

        J Offline
        J Offline
        John Kh
        wrote on last edited by
        #3

        Hy , At uni it is wireless connection and at home the connection is wired !! I mentioned that befor in the first messaged i posted ! Thx for the help Andy . J ,

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups