Ian Branch 127 Posted September 26, 2022 (edited) Hi Team, Win 11, D11.2, Indy as it came with D11.2. I am trying to receive emails from GMail so I can process them. I have the following code.. ..... with POP3 do begin Host := 'pop.gmail.com'; Username := 'MyUserName@gmail.com'; Password := 'MyPassword'; Port := 995; IOHandler := IdSSLIOHandlerSocketOpenSSL; UseTLS := utUseImplicitTLS; end; with IdSSLIOHandlerSocketOpenSSL do begin Destination := 'pop.gmail.com:995'; SSLOptions.SSLVersions := [sslvTLSv1, sslvTLSv1_1, sslvTLSv1_2]; Host := 'pop.gmail.com'; Port := 995; DefaultPort := 0; end; POP3.Connect; .... When run and it attempts to connect I get an error. "Username and password not accepted." I have verified and even reset my gmail password to no avail. I am clearly missing something, or is it a GMail thing.... Thoughts, suggestions, education appreciated. Regards & TIA, Ian Edited September 26, 2022 by Ian Branch Share this post Link to post
rvk 33 Posted September 26, 2022 1 hour ago, Ian Branch said: I have verified and even reset my gmail password to no avail. Are you using your gmail password there? That hasn't worked in months. See https://support.google.com/accounts/answer/6010255 You can't use your username and gmail password anymore. You need to enable 2FA and create and use an App password. See https://support.google.com/accounts/answer/185833 Share this post Link to post
Ian Branch 127 Posted September 26, 2022 Would I be correct in assuming that the same thing applies to IMAP?? Share this post Link to post
rvk 33 Posted September 26, 2022 (edited) Yes. That includes IMAP access. The complete "Less secure app access" option isn't available anymore. See https://myaccount.google.com/lesssecureapps And I thought App passwords were only available when you switch on 2FA. Other option is OAuth2 (which is even more a pain). Edited September 26, 2022 by rvk Share this post Link to post
Remy Lebeau 1394 Posted September 26, 2022 (edited) 6 hours ago, rvk said: Other option is OAuth2 (which is even more a pain). FYI, there is a sasl-oauth branch in Indy's GitHub repo to add OAuth2 SASL components for TIdSMTP/TIdPOP3/TIdIMAP4 (and TIdDICT). You would still have to obtain/refresh the OAuth2 token yourself from Google (or other OAuth2 provider), such as via HTTP, but Indy can then submit the token via SASL when accessing email. Edited September 26, 2022 by Remy Lebeau 1 Share this post Link to post