Sample code for 30+ languages & platforms
Delphi DLL

Authenticate with the POP3 Server

See more POP3 Examples

Demonstrates the Chilkat MailMan.Pop3Authenticate method, which authenticates with the POP3 server using the current POP3 property settings, such as PopUsername and PopPassword. It is typically called after Pop3Connect. This example connects and then authenticates.

Background: POP3 authentication is the step, after connecting, where the client identifies itself — classically with the USER and PASS commands, or a more secure mechanism. Calling Pop3Connect and Pop3Authenticate as distinct steps lets you determine precisely which phase fails, and lets you hold an authenticated session open to perform several mailbox operations before ending it with Pop3EndSession.

Chilkat Delphi DLL Downloads

Delphi DLL
var
success: Boolean;
mailman: HCkMailMan;

begin
success := False;

//  Demonstrates the MailMan.Pop3Authenticate method, which authenticates with the POP3 server
//  using the current POP3 property settings (such as PopUsername and PopPassword).  It is
//  typically called after Pop3Connect.

mailman := CkMailMan_Create();

//  Configure the POP3 server connection.
CkMailMan_putMailHost(mailman,'pop.example.com');
CkMailMan_putMailPort(mailman,995);
CkMailMan_putPopSsl(mailman,True);
CkMailMan_putPopUsername(mailman,'user@example.com');
CkMailMan_putPopPassword(mailman,'myPassword');

//  Connect first, then authenticate.

success := CkMailMan_Pop3Connect(mailman);
if (success = False) then
  begin
    Memo1.Lines.Add(CkMailMan__lastErrorText(mailman));
    Exit;
  end;

success := CkMailMan_Pop3Authenticate(mailman);
if (success = False) then
  begin
    Memo1.Lines.Add(CkMailMan__lastErrorText(mailman));
    Exit;
  end;

Memo1.Lines.Add('Authenticated with the POP3 server.');

CkMailMan_Dispose(mailman);