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 Chinese Email

Download Chilkat Email ActiveX

Delphi sample program that sends an email using Chinese characters in the subject and body.

// This example program sends an email with Chinese characters.
procedure TForm1.Button20Click(Sender: TObject);
var
  email: IChilkatEmail2;
  ok: Integer;
  chineseChars : 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';

  email := ChilkatMailMan21.NewEmail();

  // We cannot add a literal string containing Chinese characters
  // to our Delphi source code, so instead we load a file containing
  // Chinese characters in the utf-8 encoding.
  // The sample txt file can be downloaded from:
  // http://www.chilkatsoft.com/testData/chineseSample.txt
  chineseChars := email.LoadTextFileToUnicode('chineseSample.txt','utf-8');
  email.Subject := chineseChars;
  email.From := 'Chilkat Support <support@chilkatsoft.com>';
  email.AddTo('TagTooga','admin@tagtooga.com');
  email.Body := chineseChars;

  // Note: we did not indicate anything about charset.  The
  // Chilkat email component automatically recognizes that all characters
  // are Chinese and encodes the email using the gb2312 charset.
  // The subject header field is automatically "B" encoded.  If you view
  // the MIME source of the email sent, you would see these two header fields:
  //
  // Content-Type: text/plain; charset="gb2312"
  // subject: =?gb2312?B?ztLE3M3Mz8Kyo8Gntviyu8nLye3M5Q==?=
  //
  // Also, if the email component detected a mixture of several languages in the
  // email, it would've chosen the utf-8 encoding instead.  This is the only possible
  // character encoding for emails that mix languages with different multibyte encodings.

  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