Since Google stopped supporting third-party software which ask you to sign in to your Google Account using only your username and password (on May 30 2022) none of my programs that send email notifications work anymore. Is there a way to make my programs more secure to comply with Gmail's new requirements?

I am simply using System.Net.Mail
VB.NET 2010

Thanks,
Jim

Code:
    Sub SendeMail(ByVal MailMSG As String)
        Dim SmtpServer As New SmtpClient()
        Dim mail As New MailMessage()
        SmtpServer.EnableSsl = True
        SmtpServer.Credentials = New Net.NetworkCredential(MailFrom, MailPassword)
        SmtpServer.Port = MailPort
        SmtpServer.Host = MailServer
        mail = New MailMessage()
        mail.From = New MailAddress(MailFrom)
        mail.To.Add(MailTo)
        mail.Subject = "NEW IP"
        mail.Body = MailMSG
        SmtpServer.Send(mail)
       
    End Sub