Arbitur Arbitur - 5 months ago 9x Question

How do I send a gmail email in

I want to send an email, but it gives me an error.

I have this code:

Sub sendMail(ByVal title As String, ByVal content As String)
Dim SmtpServer As New SmtpClient("", 25)
SmtpServer.Credentials = New Net.NetworkCredential("", "password")
Dim mail As New MailMessage("", "", title, content)
End Sub

I have a try catch which tries to call this method, it doesnt work so the catch runs and i get thes exception:
System.Net.Mail.SmtpException: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Must issue a STARTTLS command first. b6sm3176487lae.0 - gsmtp
Why do I get this error? and how do I fix it?


Gmail uses SMTP over SSL on port 465.

Try doing:

  Dim SmtpServer As New SmtpClient("", 465)
  SmtpServer.EnableSsl = True