Results 1 to 6 of 6

Thread: Send email using gmail smtp server

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2014
    Posts
    55

    Send email using gmail smtp server

    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

  2. #2
    Addicted Member
    Join Date
    Jan 2013
    Posts
    144

    Re: Send email using gmail smtp server

    Quote Originally Posted by JimAvanti View Post
    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)
    Not really, Google stopped you from using your user/pass directly, but gives you the ability to use the so-called App Passwords

    Go to Google account > Security > Signing in to Google > App passwords

    Select your app (in your case select Other custom name) and Generate a password.
    This password is the one that you should use in your code (Not your real account password)

    Hope that helps

  3. #3

    Thread Starter
    Member
    Join Date
    Feb 2014
    Posts
    55

    Re: Send email using gmail smtp server

    Thanks for the quick reply cPubis. I must be missing something. My google account doesn't seem to have an App password option. I do have two Apps that are using my Google account though (Amazon Alexa and my cell phone).

    Name:  Signing into Google.jpg
Views: 1825
Size:  11.8 KB





    Quote Originally Posted by cPubis View Post
    Not really, Google stopped you from using your user/pass directly, but gives you the ability to use the so-called App Passwords

    Go to Google account > Security > Signing in to Google > App passwords

    Select your app (in your case select Other custom name) and Generate a password.
    This password is the one that you should use in your code (Not your real account password)

    Hope that helps

  4. #4
    Addicted Member
    Join Date
    Jan 2013
    Posts
    144

    Re: Send email using gmail smtp server

    Quote Originally Posted by JimAvanti View Post
    Thanks for the quick reply cPubis. I must be missing something. My google account doesn't seem to have an App password option. I do have two Apps that are using my Google account though (Amazon Alexa and my cell phone).
    Name:  Signing into Google.jpg
Views: 1825
Size:  11.8 KB
    App Passwords can only be used with accounts that have 2-Step Verification turned on.

    As I can see from the image you posted, you have 2-Step Verification turned off!

  5. #5

    Thread Starter
    Member
    Join Date
    Feb 2014
    Posts
    55

    Re: Send email using gmail smtp server

    Ah! I was hoping not to have to turn 2-step verification on. I suppose I am looking for a way to send an e-mail notification in a more secure way (Like the Alexa and Samsung does) that will satisfy Google's security, or if anyone can suggest a free SMTP server that I could use instead of Google or Yahoo. If not, then I guess I have no other choice but to turn on 2-Step verification.

    Thanks,
    Jim


    Quote Originally Posted by cPubis View Post
    App Passwords can only be used with accounts that have 2-Step Verification turned on.

    As I can see from the image you posted, you have 2-Step Verification turned off!

  6. #6
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Send email using gmail smtp server

    You should be using 2-step verification everywhere you can anyway.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width