sending mail with gmail smtp

Just starting out? Need help? Post your questions and find answers here.
loulou2522
Enthusiast
Enthusiast
Posts: 556
Joined: Tue Oct 14, 2014 12:09 pm

sending mail with gmail smtp

Post by loulou2522 »

I have a problem with GMAIL and the PUREBASIC e-mail module. Since May of this year it is no longer possible to send mail with a gmail account by selecting the option "Use less secure applications". Does anyone know how to bypass this security and be able to send mails with purebasic again?
Thanks in advance
I have a problem with GMAIL and the PUREBASIC e-mail module. Since May of this year it is no longer possible to send mail with a gmail account by selecting the option "Use less secure applications". Does anyone know how to bypass this security and be able to send mails with purbasic again?
User avatar
jacdelad
Addict
Addict
Posts: 2044
Joined: Wed Feb 03, 2021 12:46 pm
Location: Riesa

Re: sending mail with gmail smtp

Post by jacdelad »

Hi,
it will only work if you enable your application to use OAuth2.0. There's no OAuth2.0-Module for PureBasic available at the moment, and I think there will never be one...
Good morning, that's a nice tnetennba!

PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
Marc56us
Addict
Addict
Posts: 1600
Joined: Sat Feb 08, 2014 3:26 pm

Re: sending mail with gmail smtp

Post by Marc56us »

I have a problem with GMAIL and the PUREBASIC e-mail module. Since May of this year it is no longer possible to send mail with a gmail account by selecting the option "Use less secure applications".[...]
Yes, Google has been warning of this change for several months.
To help keep your account secure, from May 30, 2022, Google no longer supports the use of third-party apps or devices which ask you to sign in to your Google Account using only your username and password.
https://support.google.com/accounts/ans ... 0255?hl=en

A solution: Sign in with App Passwords
An App Password is a 16-digit passcode that gives a less secure app or device permission to access your Google Account....
https://support.google.com/accounts/answer/185833

:!: :arrow: But I don't know if this passcode just takes the name of the program or the fingerprint of the program. In which case it is not usable with a compiled program (checksum change every time.)
:wink:
BarryG
Addict
Addict
Posts: 4269
Joined: Thu Apr 18, 2019 8:17 am

Re: sending mail with gmail smtp

Post by BarryG »

jacdelad wrote: Fri Jul 15, 2022 3:36 pmit will only work if you enable your application to use OAuth2.0
Not quite. Gmail app passwords work, as Marc56us said. My app can send Gmails using app passwords and these PureBasic SMTP mail settings:

Code: Select all

Server: smtp.gmail.com
Flags: #PB_Mail_UseSSL
Port: 465
From: Your gmail address
Login: Your gmail address
Password: Your app password
Works like a charm.
loulou2522
Enthusiast
Enthusiast
Posts: 556
Joined: Tue Oct 14, 2014 12:09 pm

Re: sending mail with gmail smtp

Post by loulou2522 »

Hi Barry
Can you communicate
SELECT AN APPLICATION --> The name you use
SELECT A DEVICE --'> what device you use
Thanks in advance
BarryG
Addict
Addict
Posts: 4269
Joined: Thu Apr 18, 2019 8:17 am

Re: sending mail with gmail smtp

Post by BarryG »

When creating the app password, select "Other (custom name") for the app, and just type whatever you want. It's just a description. Then the "Generate" button will become enabled, and you click that the get the app password. This is the password you use in your PureBasic mail commands. You won't have to select a device when doing a custom name.

Image
loulou2522
Enthusiast
Enthusiast
Posts: 556
Joined: Tue Oct 14, 2014 12:09 pm

Re: sending mail with gmail smtp

Post by loulou2522 »

Thanks BarryG
What you describe work perfectly. I will try to write your methos for all who want to send email via gmail.com
Last edited by loulou2522 on Sat Jul 16, 2022 9:47 am, edited 1 time in total.
User avatar
jacdelad
Addict
Addict
Posts: 2044
Joined: Wed Feb 03, 2021 12:46 pm
Location: Riesa

Re: sending mail with gmail smtp

Post by jacdelad »

BarryG wrote: Sat Jul 16, 2022 3:51 am
jacdelad wrote: Fri Jul 15, 2022 3:36 pmit will only work if you enable your application to use OAuth2.0
Not quite. Gmail app passwords work, as Marc56us said. My app can send Gmails using app passwords and these PureBasic SMTP mail settings:

Code: Select all

Server: smtp.gmail.com
Flags: #PB_Mail_UseSSL
Port: 465
From: Your gmail address
Login: Your gmail address
Password: Your app password
Works like a charm.
Great, I didn't know that.
Good morning, that's a nice tnetennba!

PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
BarryG
Addict
Addict
Posts: 4269
Joined: Thu Apr 18, 2019 8:17 am

Re: sending mail with gmail smtp

Post by BarryG »

Glad I could help you both.
Post Reply