Visual C++ Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript



Visual C++ Examples

CkString
Byte Array
Bounced Mail
Bz2
Character Encoding
CSV
Digital Certificates
Digital Signatures
Email
Encryption
FTP
HTML-to-XML
HTTP
IMAP
MHT / HTML Email
RSA
S/MIME
Socket
Spider
Tar
Upload
XML
XMP
Zip Compression


More Examples...
Email Object
POP3
SMTP
RSS
Atom
Self-Extractor
Service
PPMD
Deflate
DH Key Exchange
DSA
SSH Key
SSH
SSH Tunnel
SFTP

Unreleased...
FileAccess
Bzip2
LZW
Icon

 

 

 

 

 

 

 

 

Send Korean Email

This sample C++ program shows how to send an email in Korean.

// Send a Korean email
void EmailExample(void)
    {
    CkMailMan mailman;

    // Any string passed to UnlockComponent begins the 30-day trial.
    bool unlocked = mailman.UnlockComponent("30-day trial");
    if (!unlocked)
	{
	printf("Failed to unlock component\n");
	return;
	}

    mailman.put_SmtpHost("mail.earthlink.net");
    
    CkEmail email;

    // Load a utf-8 text file containing these Korean characters: 나는 유리를 먹을 수 있어요.
    CkString str;
    str.loadFile("korean.txt","utf-8");

    // Set the email's multibyte string mode to "utf-8"
    // After doing this, all "const char *" method arguments expect
    // utf-8 strings.
    email.put_Utf8(true);

    email.put_Body(str.getUtf8());

    email.put_Subject(str.getUtf8());

    email.AddTo("Chilkat Support","support@chilkatsoft.com");

    email.put_FromName("Matt");
    email.put_FromAddress("matt@chilkatsoft.com");

    // We can explicitly set the charset by setting the Charset property.
    // However, Chilkat is smart in that it automatically recognizes the
    // Korean characters and sets the charset appropriately.
    // email.put_Charset("ks_c_5601-1987");
    // email.put_Charset("iso-2022-kr");

    // Send the email
    if (!mailman.SendEmail(&email))
	{
	mailman.SaveLastError("errors.xml");
	}

    }

*****
The MIME source of the email created by Chilkat looks is this:

MIME-Version: 1.0
Date: Fri, 20 Aug 2004 08:26:10 -0500
Message-ID: <CHILKAT-MID-50a62cf0-a52a-4231-aa6e-bb57c5d5a42b@DotNetDev>
X-Mailer: Chilkat Software Inc (http://www.chilkatsoft.com)
X-Priority: 3 (Normal)
Content-Type: text/plain; charset="ks_c_5601-1987"
Content-Transfer-Encoding: base64
subject: =?ks_c_5601-1987?B?s6q0wiDAr7iuuKYguNTAuyC89iA=?=
	=?ks_c_5601-1987?B?wNa+7r/kLg==?=
To: "Chilkat Support" <support@chilkatsoft.com>
From: "Matt" <matt@chilkatsoft.com>
return-path: matt@chilkatsoft.com

s6q0wiDAr7iuuKYguNTAuyC89iDA1r7uv+Qu

 

 

 

Need a specific example? Send a request to support@chilkatsoft.com

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

Mail Component · .NET Mail Component · XML Parser