C# Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript



C# Examples

Bounced Mail
Character Encoding
Digital Certificates
Digital Signatures
Email
FTP
HTML to XML
HTTP
IMAP
Encryption
MHT / HTML Email
MIME
RSA Encryption
S/MIME
Socket
Spider
Tar Archive
Upload
XML
XMP
Zip Compression


More Examples...
Email Object
POP3
SMTP
RSS
Atom
String
Byte Array
Self-Extractor

Unreleased...
Service
PPMD
Deflate
Bzip2
LZW
Bz2
DH Key Exchange
DSA
Icon

 

 

 

 

 

 

Setting the MIME Charset

C# example program showing how to create MIME in different charsets.

Chilkat.Mime mime = new Chilkat.Mime();
mime.UnlockComponent("anything for 30-day trial");
    
// Chilkat MIME makes it easy to create MIME in different charsets.
mime.Charset = "iso-8859-1";
mime.Encoding = "quoted-printable";

// Add some Danish text...
mime.SetBodyFromPlainText("Jeg kan spise glas, det gør ikke ondt på mig.");
    
// Add a header with some Danish chars...
mime.AddHeaderField("subject","gør ikke ondt på mig");
mime.AddHeaderField("junk1","gør på");
mime.AddHeaderField("junk2","abc 123");

textBox1.Text = mime.GetMime();
    
/* We get the following MIME.  Notice that the headers are
    Q-encoded where necessary.
    
content-transfer-encoding: quoted-printable
content-type: text/plain;
charset="iso-8859-1"
subject: =?iso-8859-1?Q?g=F8r_ikke_ondt_p=E5_mig?=
junk1: =?iso-8859-1?Q?g=F8r_p=E5?=
junk2: abc 123

Jeg kan spise glas, det g=F8r ikke ondt p=E5 mig.

    */

// Change the charset to utf-8.  With utf-8, each 8bit Danish character
// will be encoded in two bytes rather than one.
mime.Charset = "utf-8";
textBox1.Text = mime.GetMime();

/* We now get the following MIME:

content-transfer-encoding: quoted-printable
subject: =?utf-8?Q?g=C3=B8r_ikke_ondt_p=C3=A5_mig?=
junk1: =?utf-8?Q?g=C3=B8r_p=C3=A5?=
junk2: abc 123
content-type: text/plain;
charset="utf-8"

Jeg kan spise glas, det g=C3=B8r ikke ondt p=C3=A5 mig.

*/

// Chilkat supports all major international charsets, including
// Asian languages.


Important: The download for this example does not contain the ChilkatDotNet.dll which
must be downloaded and installed separately at http://www.chilkatsoft.com/downloads.asp.
Once installed, add a reference to the DLL in the project by following the instructions at
http://www.example-code.com/csharp/step2.asp

 

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

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

Email Component · XML Parser