title: Delphi and Indy 10 unable to read gmail emails 2nd. time after reading once
body: <p>I try to get the number of emails from a gmail account, it works fine for the first time, and every time after, as long I do not disconnect form the server (I stop the execution via debugger before it does the disconnect command).
  But when I execute the disconnect, I cannot retrieve the email anymore, number of emails is always 0., but the email is still in the inbox when I check online, and I can open the email online and read the content, bit cannot retrieve the email anymore with Indy.</p>
  
  <p>This only happen with gmail, not with other email accounts I tried.</p>
  
  <p>Below a part of the code.
  pop.CheckMessages returns 1 for the first time, but once I disconnect and start again, it always returns 0.</p>
  
  <p>Does anybody have a clue what I am doing wrong? Its like the mail is somehow marked and cannot be read again via email clients.</p>
  
  <pre><code>pop:=tidpop3.Create(nil);
  pop.Host := 'pop.gmail.com';
  pop.Port := 995;
  pop.Username := MyUserName;
  pop.Password := MyPassword;
  pop.ConnectTimeout := 10000;
  ssl := TIdSSLIOHandlerSocketOpenSSL.Create(nil);
  ssl.SSLOptions.Method := sslvTLSv1;
  ssl.SSLOptions.Mode := sslmClient;
  pop.IOHandler := ssl;
  pop.UseTLS := utUseImplicitTLS;
  pop.Connect;
  num:=pop.CheckMessages;
  pop.Disconnect;
  pop.Free;
  ssl.Free;
  </code></pre>