title: how to send email in vb.net windows application 2010,using gmail credentials via smtp server
body: <p>I am trying to send email in my VB.Net windows application (VS 2010), but I am getting </p>
  
  <blockquote>
    <p>SMTP host not found</p>
  </blockquote>
  
  <p>My code is as below,</p>
  
  <pre><code>Dim SmtpServer As New SmtpClient()
  SmtpServer.Credentials = New Net.NetworkCredential("mymailid@gmail.com", "mypassword")
  SmtpServer.Port = 25
  SmtpServer.Host = "smtp.gmail.com"
  SmtpServer.EnableSsl = True
  mail = New MailMessage()
  Dim addr() As String = TextBox1.Text.Split(",")
  Try
     mail.From = New MailAddress("mymailid@gmail.com", "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 &lt;&gt; 0 Then
        For i = 0 To ListBox1.Items.Count - 1
            mail.Attachments.Add(New Attachment(ListBox1.Items.Item(i)))
        Next
     End If
     SmtpServer.SendAsync(mail, mail.Subject)
  </code></pre>