# Visual Basic > Visual Basic .NET >  Sending mail failure on VB.NET 2019

## pourkascheff

Hi all,
I found this tutorial very easy and understandable. I followed it's instructions but following exception was thrown:


I turned off my email two-step verification but according to https://myaccount.google.com/lesssecureapps, this item is no longer supported.

Code for record:


```
Imports System.Net.Mail
Public Class Form2
    Private Sub SendBtn_Click(sender As Object, e As EventArgs) Handles SendBtn.Click
        Me.Cursor = Cursors.WaitCursor
        GroupBox1.Enabled = False
        Try
            Dim SMTP_SERVER As New SmtpClient
            Dim E_MAIL As New MailMessage
            SMTP_SERVER.UseDefaultCredentials = False
            SMTP_SERVER.Credentials = New Net.NetworkCredential(Usertxt.Text, Passtxt.Text)
            SMTP_SERVER.Port = 587
            SMTP_SERVER.EnableSsl = True
            SMTP_SERVER.Host = "smtp.gmail.com"
            E_MAIL = New MailMessage
            E_MAIL.From = New MailAddress(Usertxt.Text)
            E_MAIL.To.Add(Addresstxt.Text)
            E_MAIL.Subject = Subjecttxt.Text
            E_MAIL.IsBodyHtml = False
            E_MAIL.Body = Messagetxt.Text
            SMTP_SERVER.Send(E_MAIL)
            Me.Cursor = Cursors.Default
            GroupBox1.Enabled = True
            MsgBox("Successfully sent.", MsgBoxStyle.Information)
        Catch ex As Exception
            Me.Cursor = Cursors.Default
            MsgBox(ex.Message.ToString, MsgBoxStyle.Critical)
            GroupBox1.Enabled = True
            Addresstxt.Focus()
        End Try
    End Sub
End Class
```

- How can I rectify the matter?
- What does the 'server response was: 5.7.0' mean?

----------


## Peter Porter

Firstly, your link doesn't work. Secondly, we shouldn't have to sign-in to read the correct link:
https://myaccount.google.com/lesssecureapps

A simple Google search, the information is readily available to read without signing in:
https://support.google.com/accounts/.../6010255?hl=en

On the link you provided, if it's what you saw signed in, if you would've click "Learn more", the next page will tell you everything you need to know to make your app meet Google's new stardards. You then follow the information, which might require more Googling of it, and you should be able to update your app to make it secure in order for it to sign into personal accounts.

----------


## pourkascheff

Based on last paragraph, our winform applications use less-secure-technology. Their recommendation is using a 16-digit app-password, The question is how? I googled. (Results may vary due to location differences, but not too much) What was your approach? Do we have to pay google? How about SSL things? You mean nobody did an auto-email app since may2022???

Update: VS codetooltip/help indicates the term "SecureString" but I did not follow how to use it.
Attachment 186453

----------


## paulg4ije

Sign in to the relevant Google account and go to "Security". Turn on "2-step verification" and then click on "App passwords".

----------


## Peter Porter

> Sign in to the relevant Google account and go to "Security". Turn on "2-step verification" and then click on "App passwords".


Here's instructions on how to do this with some code:
https://stackoverflow.com/questions/...nger-available

Hopefully it still works.

After creating the app password for yourself, or under someone elses account, before it works Google will send a verification email to you or that person asking if you created an app password. After clicking yes, the app should have access.

----------

