Using gmail after May 30, 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
Walter Roberson
2022년 3월 16일
The site https://support.google.com/a/answer/176600?hl=en#zippy=%2Cuse-the-gmail-smtp-server hints about using OAuth, and the following discuses using OAuth from MATLAB
Joseph Hejl
2022년 3월 16일
Walter Roberson
2022년 3월 16일
"Older scanners or printers might not support OAuth, which lets apps and devices share your Google account data without requiring your username or password. In this case, take these steps before you set up the device:
Turn on less secure apps in the Admin console."
So if you cannot use OAuth (now) then you start by turning on Less Secure.
But flip that around: If you need to turn on Less Secure if a condition is not met, then the implications are that you do not need to turn on Less Secure if you can do OAuth. And if the challenge is that you will not be able to turn on Less Secure later, then we can hypothesize that there will be no problem using OAuth since it does not use Less Secure anyhow.
Joseph Hejl
2022년 3월 16일
Joseph Hejl
2022년 3월 16일
Rik
2022년 3월 16일
It sounds like you should post that last comment as an answer. That way other people can try this solution as well.
채택된 답변
추가 답변 (1개)
Ivan
2023년 11월 21일
In my side works perfect the folowing code
server='smtp.gmail.com';
setpref('Internet','E_mail', mail);
setpref('Internet','SMTP_Server', server);
setpref('Internet','SMTP_Username', mail);
setpref('Internet','SMTP_Password', password);
props = java.lang.System.getProperties
props.setProperty( 'mail.smtp.auth', 'true' );
props.setProperty( 'mail.smtp.user', mail );
props.setProperty( 'mail.smtp.password', password );
props.setProperty( 'mail.smtp.host', server );
props.setProperty( 'mail.smtp.port', '587' );
props.setProperty( 'mail.smtp.starttls.enable', 'true' );
Also,pay attention that “App Paswords”includesspaces between groups of numbers when you copy it from Google.
카테고리
도움말 센터 및 File Exchange에서 Web Services에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!