Delphi Examples

ChilkatHOMEAndroid™Classic ASPCC++C#C# WinRTDelphi ActiveXDelphi DLLVisual FoxProJavaMFCObjective-CPerlPHP ActiveXPHP ExtensionPowerShellPythonRubySQL ServerUnicode CUnicode C++Visual Basic 6.0VB.NETVB.NET WinRTVBScript

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

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

// This example program sends an email with Japanese characters.
procedure TForm1.Button20Click(Sender: TObject);
var
  email: IChilkatEmail2;
  ok: Integer;
  japaneseChars : 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 Japanese characters
  // to our Delphi source code, so instead we load a file containing
  // Japanese characters in the utf-8 encoding.
  // The sample txt file can be downloaded from:
  // http://www.chilkatsoft.com/testData/japaneseSample.txt
  japaneseChars := email.LoadTextFileToUnicode('japaneseSample.txt','utf-8');
  email.Subject := japaneseChars;
  email.From := 'Chilkat Support <support@chilkatsoft.com>';
  email.AddTo('Joe','joe@gmail.com');
  email.Body := japaneseChars;

  // Note: we did not indicate anything about charset.  The
  // Chilkat email component automatically recognizes that all characters
  // are Japanese and encodes the email using the shift_JIS 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="shift_jis"
  // subject: =?shift_jis?B?joSCzYNLg4mDWILwkEiC14LnguqC3IK3?=
  //
  // 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;

 

 

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