title: smtp sending mail message from ASP.NET
body: <p>I have a form on an asp.net Website that is hosted over at tedata (hosting company) that users can fill out and send to our company. I am currently testing it using a Gmail account. the email send fine from my localhost, but when I publish it to the web server the mail does not send and there is no error message, can any one help me,
  here is my code:</p>
  
  <pre><code>Public Sub SendMail()
          Dim fromAddress = "eisegypt2017@gmail.com"
          Dim toAddress = "toAddress"
          Dim fromPassword As String = "fromPassword"
  
          Dim subject As String = "Mail"
          Dim body As String = "From: " + yourname.Value + vbCrLf + vbCrLf
          body = body + "Company: " + yourcompany.Value + vbCrLf + vbCrLf
          body = body + "Email: " + youremail.Value + vbCrLf + vbCrLf
          body = body + "Phone: " + yourphone.Value + vbCrLf + vbCrLf
          body += "Subject: " + subject + vbCrLf + vbCrLf
          body += "Message: " + yourmessage.Value + vbCrLf
  
          ' smtp settings
          Dim smtp = New System.Net.Mail.SmtpClient()
          Dim omail As New System.Net.Mail.MailMessage
          smtp.Host = "smtp.gmail.com"
          smtp.Port = 587
          smtp.EnableSsl = True
          smtp.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network
          smtp.Credentials = New System.Net.NetworkCredential(fromAddress, fromPassword)
          smtp.Timeout = 20000
  
          ' Passing values to smtp object
           smtp.Send(fromAddress, toAddress, subject, body)
  
      End Sub
  </code></pre>