Delphi Examples

ChilkatHOMEAndroid™ASPVisual BasicVB.NETC#iOS (IPhone)Objective-CC++CMFCDelphiFoxProJavaPerl
PHP ExtensionPHP ActiveXPythonPowerShellRubySQL ServerVBScript

Delphi Examples

Bounced Mail
Bz2
Character Encoding
CSV
DKIM / DomainKey
Digital Certificates
Digital Signatures
DH Key Exchange
DSA
Email
Email Object
FTP
HTML Conversion
HTTP
IMAP
Encryption
MHT / HTML Email
NTLM
POP3
RSA
S/MIME
SMTP
Socket
Spider
SFTP
SSH
SSH Key
SSH Tunnel
String
Tar
Upload
XML
XMP
Zip Compression

More Examples...
Amazon S3
Byte Array
FileAccess
RSS
Atom
Self-Extractor
Service
PPMD
Deflate
Bzip2
LZW

Type Conversion

 

Article: Understanding COM References in Delphi

Send Email with Zipped Attachments

Download Chilkat Email ActiveX

Delphi example code to create an email with file attachments, zip them in-memory to create a single .zip attachment, and send.

// Create an email with file attachments, then replace them with
// a single .zip file attachment.
procedure TForm1.Button15Click(Sender: TObject);
var
  email: IChilkatEmail2;
  ok: Integer;

begin
  // A ChilkatMailMan2 ActiveX component was dropped onto the Delphi
  // form, and this became the Form's member variable "ChilkatMailMan21".

  ChilkatMailMan21.UnlockComponent('Anything for 30-day trial');
  ChilkatMailMan21.SmtpHost := 'smtp.comcast.net';

  email := ChilkatMailMan21.NewEmail();
  email.Subject := 'Email with attachments sent from a Delphi program!';
  email.From := 'Chilkat Support <support@chilkatsoft.com>';
  email.AddTo('Chilkat Admin','admin@chilkatsoft.com');
  email.Body := 'This email was sent from a Delphi program...';

  // Add a few file attachments.
  email.AddFileAttachment('dude.gif');
  email.AddFileAttachment('fw9.pdf');

  // Add an attachment directly from an in-memory string.
  email.AddStringAttachment('test.xml','<test><companyName>Chilkat Software</companyName></test>');

  // The following call to ZipAttachments replaces the 3 existing attachments with
  // a single "attachments.zip" file attachment.  The contents of "attachments.zip"
  // are dude.gif, fw9.pdf, and test.xml.  NOTE: The "attachments.zip" file never exists
  // no the filesystem.  It is created completely in-memory.  The receiving email client
  // will receive an email with a valid .zip attachment, which can be unzipped to retrieve
  // the files contained within.
  email.ZipAttachments('attachments.zip');

  ok := ChilkatMailMan21.SendEmail(email);
  if (ok = 0) then
        ChilkatMailMan21.SaveLastError('errorLog.xml');

end;

 

 

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

Mail Component · .NET Email Component · XML Parser