title: The SMTP server requires a secure connection VB.NET
body: <pre><code> Dim smtp As New SmtpClient
                      Dim mail As New MailMessage
                      smtp.Credentials = New Net.NetworkCredential("mail@gmail", "password")
                          mail.From = New MailAddress("mail@gmail.com")
                          mail.To.Add(totxt.Text$)
                          mail.Body = bodytxt.Text
                          If Not ListBox1.Items.Count &lt;= 0 Then
                              Dim d As Integer
                              Dim attach As New Attachment(ListBox1.Items(d))
                              mail.Attachments.Add(attach)
                          End If
                      mail.Subject = subjecttxt.Text
                      smtp.EnableSsl = True
                      smtp.Port = "587"
                      smtp.Host = "smtp.gmail.com"
                      smtp.Send(mail)
                      smtp.Dispose()
                      done.Text = "Mail sent"
                      PictureBox4.BackgroundImage = My.Resources.tickfnl
                      dtls.Visible = False
  </code></pre>
  
  <p>I am trying to send email from my gmail account.But i am getting the error "The SMTP Server requires a secure connection".I even enabled LESS-SECURE APP login in my account settings.The password and email address is correct.I tried another email but same issue.Any fix ?</p>
  
  <p><strong>I TRIED ALL THE SOLUTIONS FROM THE DUPLICATE LINK,STILL THE SAME PROBLEM</strong></p>
  
  <p>**IF I REMOVE THIS LINE </p>
  
  <pre><code>smtl.enablessl=true
  </code></pre>
  
  <p>then i get this error </p>
  
  <p>the server resposnse was 5.7.0  **</p>
  
  <p><strong>Fixed the error using EASendMail</strong></p>