Sending via Gmail from Xojo App - oAuth? Plugins? Help?

Can you please post a link to the new rules?

All this whole conversation is doing is to convince me not to bother with OAuth in my app.

I do not find anything that leads me to believe that support of 2 Factor Authentication being turned on and using a created App Password is going away. I posted this link above but will post it again that this very question was asked on the Gmail Forum and the answer was that it was not going away.

Link to Google Support

Question asked:

Less secure apps & your Google Account - Termination date of May 30th 2022
I am attempting to get clarification on this statement below in reference to less secure apps.

To help keep your account secure, starting May 30, 2022, ​​Google will no longer support the use of third-party apps or devices which ask you to sign in to your Google Account using only your username and password.

My question is if the app is utilizing the google produced “password” that you can get when you utilize the two factor authentication will it also be impacted by the May 30th termination?

We have several users that utilize gmail with our IP communication device and I am looking to gain a better understanding of what is needed to assure that their access to Gmail will continue after the May 30th deadline.

Thanks,
Mike

Answer:

No, it shouldn’t be. Using an application password with 2-step verification is a “secure” access method.

Hi Steve or any Forum-member,
Could you provide more info on how to use the “2-step” verification?

I am using this as a guide

It worked excellent until today when I got this message
“Username and Password not accepted.”

Thanks.

Lennox

My users using gmail use exactly what Steve stated. App password, that is only available if the user activates 2 factor authentication, then they will need to create the App Password and type it in the password field of the app. Works flawless and is not going away.

OK, I set up “Signing in with 2-Step Verification” and it is on but I am using my app on a computer and I do not see where i can do that on a computer, I am only seeing options for phones.

Any help?

Thanks.

lennox

Activating 2FA:
https://myaccount.google.com/signinoptions/two-step-verification

Creating App Passwords:
https://myaccount.google.com/apppasswords

So, let’s say your gmail account is leno_@gmail.com, and your password is “banana”, you should keep using it as usual, but your app will need to login using leno_@gmail.com and the weird and long app password the system created for it like ab9ab89dg7s9df9f7g

1 Like

I need the app passwords for Google so often that I made a guide with screenshots:

I also have a similar article for iCloud app specific passwords.

2 Likes

Thanks,
I got it just before receiving your reply.
I will use your message in case I get further problems.

Thanks again.
Lennox

I’m a bit confused by this…

My situation… I have a an app that needs to send notification of tmhuings coming our and pas due that runs unattended.

In the pAst for Gmail, when less secure apps were not possible I just had it log into email suing SMPTSocket with a hard coded username and password…

So If I get an App password instead of the regular one all else stays they same?

When created an app password it asks for a device… does that matter? If you use custom name does the app have to enter that too?
-Karen

Everything stays the same, your previous password still in place for logging into your account. You will be ADDING new passwords for each app. Some known apps harden the ties to devices. If you have a custom app, add its name to the list, for example “MyGreatSMTPApp”. Custom apps does not require a device. If the users changes their main password, all Apps Passwords will be invalidated and will need to be redone.

If I understand you correctly, I need to put a name in for my app which is running locally (Not in the google cloud), I should not NOT choose Mail as the app even though I want to send mail through google? Is that right?

And If I don’t need to do that then there is no device name… But if I did need to enter Mail as the app, the I would use a custom device name to make it device agnostic?

Thanks,
-Karen

App specific passwords for Google are device specific. You don’t need to enter Mail as the app for the app specific password because Mail supports OAuth (sometimes, not on High Sierra because it’s too old and Monterey didn’t do the OAuth either).

Most secure: Choose what you want and what device, get a password.
A bit less secure: Name your app, get a password.

If you intend SMTP/POP or Imap just for email I/O the e-mail option and from what device may get you covered. Try it.

If you want other listed services, choose properly. Test it.

If you want a more open approach, inform your app, get a password, then try to connect it using the known protocols and ports like connections to the IMAP server at imap.gmail.com:993 and the POP server at pop.gmail.com:995 require SSL. The SMTP server, smtp.gmail.com, requires TLS. Use port 465, or port 587 if your client begins with plain text before issuing the STARTTLS command. Probably will work more freely.

The last one is what I use all the time, just add my app and get a password. My apps logs into those servers and ports using proper protocols.

So you are saying this code should work without any plugins? (2019R1.1 code)

Dim MailSocket as New SMTPSecureSocket
MailSocket.Address = "smtp.gmail.com"
MailSocket.Port = 465
MailSocket.ConnectionType = SMTPSecureSocket.TLSv1
MailSocket.SMTPConnectionMode = SMTPSecureSocket.ModeSSLTLS
MailSocket.Secure = True
MailSocket.UserName = <GmailUserName>
MailSocket.Password = <AppPassword>

Dim mail  as New EmailMessage
' Create the message

MailSocket.Messages.Append(mail)
MailSocket.SendMail

If so great!

Thanks,
-Karen

Getting an app-specific p/w from your logged in gmail account and pasting that into your email client is the only change needed. (or your Xojo code).

Not true starting today if it’s not an app password.

Increase this to TLSv12

If it does not work change the port to 587 and handshake to STARTTLS