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 Email using utf-8 Encoding

Sample C++ program to showing how to send email using the utf-8 charset. The only difference between this example and the example to send iso-8859-1 is that the Charset property is set to "utf-8". Notice how the email that is constructed is very different.

// Send an email using the utf-8 character encoding
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");
    
    // Send an email using the utf-8 charset encoding.
    CkEmail email;

    email.put_Body("This is the email body Û Ü Ý Þ ß à á â");

    email.put_Subject("Û Ü Ý Þ ß à á â");

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

    email.put_FromName("ç è é ê ë");
    email.put_FromAddress("matt@chilkatsoft.com");

    email.put_Charset("utf-8");

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

    }

****************
The MIME text of the email created by this example  looks like this:


MIME-Version: 1.0
Date: Fri, 20 Aug 2004 07:49:32 -0500
Message-ID: <CHILKAT-MID-4645686d-8fd4-420a-b49d-ce49574011cb@DotNetDev>
X-Mailer: Chilkat Software Inc (http://www.chilkatsoft.com)
X-Priority: 3 (Normal)
Content-Transfer-Encoding: quoted-printable
subject: =?utf-8?B?w5sgw5wgw50gw54gw58gw6Agw6Egw6I=?=
To: =?utf-8?B?Q2hpbGthdCDDniDDnyBTdXBwb3J0?= <support@chilkatsoft.com>
From: =?utf-8?B?w6cgw6ggw6kgw6ogw6s=?= <matt@chilkatsoft.com>
return-path: matt@chilkatsoft.com
Content-Type: text/plain; charset="utf-8"

This is the email body =C3=9B =C3=9C =C3=9D =C3=9E =C3=9F =C3=A0 =C3=A1 =
=C3=A2

 

 

 

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