Using gmail after May 30, 2022

368 views (last 30 days)
Joseph Hejl
Joseph Hejl on 15 Mar 2022
Commented: Joseph Hejl on 18 Mar 2022
I am currently using Matlab to send emails using Gmail with "less secure apps" selected to "ON" under Google Security. This topic has been discussed at length in several threads and I currently have no problems, however, as per Google: "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."
So, after May, 30th, I will no longer be able to use Matlab to send emails via Gmail. Does anyone have a work around for this?
  6 Comments
Rik
Rik on 16 Mar 2022
It sounds like you should post that last comment as an answer. That way other people can try this solution as well.

Sign in to comment.

Accepted Answer

Joseph Hejl
Joseph Hejl on 16 Mar 2022
I think I have it working. In Google Security "Less Secure Apps" is turned OFF. Enable 2-Step authentication and log in to the Google Gmail account. Search for "App Paswords", and under "Select app" type "MATLAB" without the quotes, then press "Generate" button. This produces a 16-digit passcode that is then used in place of the Gmail account password. So use the above code but replace
password = 'MyPassword'; %Your GMail password
with
password = 'MyPasscode'; %Your GMail 16-digit passcode
  2 Comments
Joseph Hejl
Joseph Hejl on 18 Mar 2022
Ash Ash. Glad I could help. Knew this was an upcoming problem, but couldn't find the solution. Got the idea from my AOL account, which warned me of a similar deadline but gave an indication of how to generate a special 16-digit passcode for trusted apps, like MATLAB. Took some more searching, as Google was much less clear, but ended up having a similar 16-digit passcode generator. I'm sure this is going to save a lot of people some unnecessary future headaches, and really doesn't require any modifications to the existing MATLAB code other than to use the 16-digit passcode instead of the usual Gmail password.

Sign in to comment.

More Answers (0)

Products


Release

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!