VB.NET Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++DelphiFoxProJavaPerlPythonRubySQL ServerVBScript

Delphi Examples

Bounced Mail
Character Encoding
Digital Certificates
Digital Signatures
Email
FTP
HTML-to-XML
HTTP
IMAP
Encryption
MHT / HTML Email
RSA Encryption
S/MIME
Socket
Spider
String
Tar
Upload
XML
XMP
Zip Compression

More Examples...
Byte Array
Email Object
POP3
SMTP
RSS
Atom
Self-Extractor

Unreleased...
Service
PPMD
Deflate
Bzip2
LZW
Bz2
DH Key Exchange
DSA
Icon

Type Conversion

 

Article: Understanding COM References in Delphi

SSL POP3 with Certificates

Demonstrates how to use a client-side certificate with an SSL connection to a POP3 server. Also demonstrates how to get the POP3 server's SSL certificate.

Download Chilkat Email ActiveX

uses
    Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
    Dialogs, StdCtrls,
    CHILKATMAILLib2_TLB,
    CHILKATCERTIFICATELib_TLB,
    OleCtrls;

...

procedure TForm1.Button1Click(Sender: TObject);
var
mailman: TChilkatMailMan2;
success: Integer;
clientCert: TChilkatCert;
serverCert: IChilkatCert;

begin
//  The mailman object is used for receiving (POP3)
//  and sending (SMTP) email.
mailman := TChilkatMailMan2.Create(Self);

//  Any string argument automatically begins the 30-day trial.
success := mailman.UnlockComponent('30-day trial');
if (success <> 1) then
  begin
    ShowMessage('Component unlock failed');

  end;

//  Set the GMail account POP3 properties.
mailman.MailHost := 'pop.gmail.com';
mailman.PopUsername := 'chilkat.support';
mailman.PopPassword := '****';
mailman.PopSsl := 1;
mailman.MailPort := 995;

//  Use our certificate, which is already installed
//  in our current-user certificate store on the computer.
clientCert := TChilkatCert.Create(Self);
success := clientCert.LoadByCommonName('Chilkat Software, Inc.');
if (success <> 1) then
  begin
    ShowMessage(clientCert.LastErrorText);

  end;
//  Note: The GMail POP3 server does not require that you
//  have a client cert.  This example only demonstrates
//  how you may use a client certificate.  Typically,
//  higher-security systems may require a client-side SSL cert.
mailman.SetSslClientCert(clientCert);

//  Establish a POP3 connection:
success := mailman.Pop3BeginSession();
if (success <> 1) then
  begin
    ShowMessage(mailman.LastErrorText);

  end;
//  Let's look at the LastErrorText to see the details
//  of the successful connection.  We should see our cert:
Memo1.Lines.Add(mailman.LastErrorText);

//  OK, now examine the server's cert:

serverCert := mailman.GetPop3SslServerCert();
if (serverCert = nil ) then
  begin
    ShowMessage('No server cert available.');
  end
else
  begin
    Memo1.Lines.Add('Server SSL certificate:');
    Memo1.Lines.Add(serverCert.SubjectDN);

    //  Was the server certificate verified?
    //  It's not necessarily an error if the SSL Server cert is not verified.
    if (mailman.Pop3SslServerCertVerified = 1) then
      begin
        Memo1.Lines.Add('Server SSL certificate was verified.');
      end
    else
      begin
        Memo1.Lines.Add('Server SSL certificate was NOT verified!');
      end;
  end;


end;

 

Need a specific example? Send a request to support@chilkatsoft.com

© 2000-2007 Chilkat Software, Inc. All Rights Reserved.

Mail Component · .NET Email Component · XML Parser