Can't fetch email from gmail using Indy

Viewed 232

I use TIdPOP3 a lot, and it works great, except for GMail accounts.

Somehow it never works. I tried different combinations and ports, with and without SSL, and it always returns different errors.

My most recent try was to create an 'app specific' password on Gmail, and trying to connect using this password, on port 995. This time it returns 'Connection Closed Gracefully'.

Resolving hostname pop.gmail.com.
Connecting to 172.217.192.108.
Connected.
Disconnected.
Connection Closed Gracefully.

I also tried this:

popb.Host := 'pop.gmail.com';
popb.username := 'myacount@gmail.com';
popb.password := 'mypassword';
popb.Port := 995;
popb.IOHandler := sslpop;
popb.UseTLS := utUseImplicitTLS;
with sslpop do
begin
  Destination := 'pop.gmail.com:995';
  Host := 'pop.gmail.com';
  Port := 995;
  DefaultPort := 0;
end;

In this last example, it returns this error:

Error connecting with SSL. error:00000006:lib(0):func(0):EVP lib

This specific account I'm trying to fetch has 2-step verification; does this make it impossible to use with Indy?

1 Answers

I could fix the issue by setting Ssloptions.Method := sslvSSLv23.

Here is the full working code :

    pop.Host := 'pop.gmail.com';
    pop.username := 'myemail@gmail.com';
    pop.password := 'mypassword';
    pop.Port := 995;
    pop.IOHandler := sslpop;
    pop.UseTLS := utUseImplicitTLS;
    with sslpop do
    begin
      Destination := 'pop.gmail.com:995';
      Ssloptions.Method := sslvSSLv23;
      Host := 'pop.gmail.com';
      Port := 995;
      DefaultPort := 0;
    end;
Related