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
Service
PPMD
Deflate
DH Key Exchange
DSA

Unreleased...
Bzip2
LZW
Bz2
Icon

Type Conversion

 

Article: Understanding COM References in Delphi

Create Multipart/Alternative MIME

Create a simple multipart/alternative MIME message.

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

...

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

begin

mime := CoChilkatMime.Create();

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

//  Make this a multipart/alternative MIME message:
mime.NewMultipartAlternative();

//  Create a plain-text part and add it to the multipart/alternative MIME.
ptMime := CoChilkatMime.Create();
ptMime.SetBodyFromPlainText('This is the plain-text body');
mime.AppendPart(ptMime);

//  Now do the same for HTML:
htMime := CoChilkatMime.Create();
htMime.SetBodyFromHtml('<html><body>This is the HTML body</body></html>');
mime.AppendPart(htMime);

//  Show the full multipart/alternative MIME text which includes both parts:
Memo1.Lines.Add(mime.GetMime());

//  Need to change the boundary string?
mime.Boundary := '__NewBoundaryString__123';

//  Need to change the charset?
ptMime := mime.GetPart(0);
ptMime.Charset := 'utf-8';
htMime := mime.GetPart(1);
htMime.Charset := 'utf-8';

//  Need to change the encoding?
htMime.Encoding := 'base64';

//  Now show the MIME again:
Memo1.Lines.Add('---- After Changes ----');
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