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

Send HTML Email with Embedded Images

Download Chilkat Email ActiveX

Delphi sample program that creates and sends an HTML email with embedded images.

{
  This Delphi example code demonstrates creating and sending a simple
  HTML email with embedded images.
}
procedure TForm1.Button10Click(Sender: TObject);
var
  email: IChilkatEmail2;
  ok: Integer;
  contentId: WideString;

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';

  // If our SMTP server requires authentication, set the username/password.
  //ChilkatMailMan21.SmtpUsername := 'myUsername';
  //ChilkatMailMan21.SmtpPassword := 'myPassword';

  email := ChilkatMailMan21.NewEmail();
  email.Subject := 'Email sent from a Delphi program!';
  email.From := 'Chilkat Support <support@chilkatsoft.com>';
  email.AddTo('Chilkat Admin','admin@chilkatsoft.com');
  email.AddTo('Matt','matt@chilkatsoft.com');
  email.AddTo('TagTooga','admin@tagtooga.com');

  // Add a GIF image as a related-item to the email.  This GIF image will
  // be displayed within the HTML email body.
  contentId := email.AddRelatedFile('dude.gif');
  email.SetHtmlBody('<html><body>This is an HTML email...<p><img src="cid:' + contentId + '" /></body></html>');

  //Save the email as an EML file so we can review the MIME if desired...
  email.SaveEml('e.eml');
  
  // Connect to the SMTP server and send the email.
  ok := ChilkatMailMan21.SendEmail(email);
  if (ok = 0) then
        ChilkatMailMan21.SaveLastError('errorLog.xml');

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