For the curious:
Maybe this article helps:
http://www.delphifeeds.com/go/s/58867You need to download some files here (for SSL support). Those are DLL's so this only runs on Windows.
[EDIT] the SSL files are on
http://indy.fulgan.com/SSL/ [/EDIT] :-)
I have explicit added a disconnect, in your code the client would stay connected.
Standard coding as I have seen is in a buttonclick or whatever event wich connects, does everthing needed and disconnects again. I doubt if the IDPOP3 component will allow a disconnect in it's connect event.
to the uses section of the unit, I added:
IdSSLOpenSSL, IdExplicitTLSClientServerBase
My code for button1 click:
procedure TForm1.Button1Click(Sender: TObject);
var
msgs: integer;
begin
IdPOP3_1.Host := 'pop.gmail.com';
IdPOP3_1.Username := 'someaccount';
IdPOP3_1.Password := 'somepassword';
IdPOP3_1.Port := 995;
try
IdPop3_1.IOHandler := TIdSSLIOHandlerSocketOpenSSL.Create(idPop3_1);
IdPop3_1.UseTLS := utUseImplicitTLS;
IdPOP3_1.Connect;
Application.ProcessMessages;
msgs := IdPop3_1.CheckMessages;
ShowMessage(Format('Msgs: %d', [msgs]));
idPop3_1.Disconnect;
except
on E: Exception do
begin
ShowMessage(E.Message);
end;
end;
ShowMessage('Success');
end;
This will stop the error and report the number of new messages. Good luck!
b.t.w.: application processmessages is not needed here.