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

 

 

 

 

 

 

Create Multipart/Mixed MIME Message

C# example program showing how to create a multipart/mixed MIME message with two sub-parts: a text/plain body and a GIF file attachment.

// Demonstrates how to create a multipart/mixed MIME message
// with 2 sub-parts: a text/plain body and a GIF file attachment.
Chilkat.Mime mime = new Chilkat.Mime();
mime.UnlockComponent("anything for 30-day trial");

// Initialize to a multipart/mixed content-type:
mime.NewMultipartMixed();

// Create a text/plain MIME part.
Chilkat.Mime textBody = new Chilkat.Mime();
textBody.SetBodyFromPlainText("This is the plain-text body!\nThank you.");

// Add it as a child to the multipart/mixed parent:
mime.AppendPart(textBody);

// Load a GIF file as a new sub-part:
mime.AppendPartFromFile("dude.gif");

// Chilkat automatically generates a unique boundary string.
// Need to change it?  Do this:
mime.Boundary = "123--ABC--Blah-blah-blah";

// What did we get?
textBox1.Text = mime.GetMime();
				
/*
This is the MIME produced:


content-type: multipart/mixed;
	boundary="123--ABC--Blah-blah-blah"

This is a multi-part message in MIME format.

--123--ABC--Blah-blah-blah
content-type: text/plain;
	 charset="us-ascii"
content-transfer-encoding: 7bit

This is the plain-text body!
Thank you.
--123--ABC--Blah-blah-blah
content-disposition: attachment;
	 filename="dude.gif"
content-transfer-encoding: base64
content-type: image/gif;
	name="dude.gif"

R0lGODlhZABkAPf/AP////f39+fn7+/v9/f3/+fn99bW597e79bW78bG3s7O57291rW1zsbG
57293rW11q2tzqWlxq2t1qWlzpycxpSUvYyMtYSErZyczpSUxoyMvYSEtXt7rYSEvXt7tXNz
rWtrpWNjnFpalGNjpVJSjFpanEpKhFJSlEJCe0pKjEJChDk5czk5ezExazExcykpYykpayEh
...
eRVHL+9I+xlJPxtT1aa4AWSX2vkeyQM3ALOUszWGNEYsIFjkMawkoAFLMwLozjZPIZuSWRC8
wxAGcf2vMwE08FYXMvmrAuSR4E84VAhILTAsJDIijyQim9P1jVQpglWrG0ADLOABJYG5GjBs
ClERHqH/GBUQADs=

--123--ABC--Blah-blah-blah--

*/


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