Delphi Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL 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

S/MIME Signed Message

Create an S/MIME signed (PKCS7) message.

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

...

procedure TForm1.Button1Click(Sender: TObject);
var
mime: CHILKATMIMELib_TLB.IChilkatMime;
success: Integer;
cert: TChilkatCert;

begin
mime := CoChilkatMime.Create();

success := mime.UnlockComponent('Anything for 30-day trial.');
if (success = 0) then
  begin
    ShowMessage(mime.LastErrorText);
    Exit;
  end;

mime.AddHeaderField('Subject','This is a test');
mime.AddHeaderField('Abc','123');

mime.SetBodyFromPlainText('This is the body');

cert := TChilkatCert.Create(Self);
//  Load a certificate that has already been installed (from a .pfx)
//  on the computer:
success := cert.LoadByEmailAddress('thawte@chilkatsoft.com');
if (success = 0) then
  begin
    ShowMessage(cert.LastErrorText);
    Exit;
  end;

//  Convert to a signed message.
success := mime.ConvertToSigned(cert.ControlInterface As CHILKATMIMELib_TLB.IChilkatCert);
if (success = 0) then
  begin
    ShowMessage(mime.LastErrorText);
    Exit;
  end;

//  Display the signed MIME:
Memo1.Lines.Add(mime.GetMime());

Memo1.Lines.Add('----');

//  Unwrap to restore the original MIME.
success := mime.UnwrapSecurity();
if (success = 0) then
  begin
    ShowMessage(mime.LastErrorText);
    Exit;
  end;

//  Display the restored (unsigned) MIME:
Memo1.Lines.Add(mime.GetMime());

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