How To Use POP3 with SSL

uses
  blcksock, smtpsend, pop3send, ssl_openssl,
//...
 
type
  ESMTP = class (Exception);
  EPOP3 = class (Exception);
 
//...
 
procedure TForm1.edReceiveClick(Sender: TObject);
var
  pop3: TPOP3Send;
  i: integer;
begin
  pop3 := TPOP3Send.Create();
  try
    pop3.AutoTLS := false;
    pop3.Username:='test';
    pop3.Password:='*****';
    pop3.TargetHost:='127.0.0.1';
    pop3.TargetPort := '995';
    pop3.FullSSL := true;
    pop3.Sock.SSL.SSLType := LT_SSLv3;
 
    pop3.Sock.SSLDoConnect();
    if not pop3.Login() then
      raise EPOP3.Create('POP3 ERROR: Login');
 
    AddToLog('POP3 Stat');
    if not pop3.Stat() then
      raise EPOP3.Create('POP3 ERROR: stat');
    AddToLog('Stat: '+IntToStr(pop3.StatCount)+' msgs');
    for i := 1 to pop3.StatCount do begin
      AddToLog('POP3 Retr(' + IntToStr(i) + ')');
      if not pop3.Retr(i) then
        raise EPOP3.Create('POP3 ERROR: retr(' + IntToStr(i) + ')');
      RichEdit2.lines.Add(' ');
      RichEdit2.lines.Add('*** POP3 Retr(' + IntToStr(i) + ') *******');
      RichEdit2.lines.AddStrings(pop3.FullResult);
      pop3.FullResult.SaveToFile('mail_' + IntToStr(i) + '.msg');
      if not pop3.Dele(i) then
        raise EPOP3.Create('POP3 ERROR: dele(' + IntToStr(i) + ')');
    end;
 
  finally
    pop3.Free;
  end;
end;
public/howto/pop3samplessl.txt · Last modified: 2007/11/30 14:30 (external edit)
Driven by DokuWiki Recent changes RSS feed