Chilkat HOME ASP Visual Basic VB.NET C# Visual C++ C MFC Delphi FoxPro Java Perl PHP Python Ruby SQL Server VBScript
|
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 |
Need a specific example? Send a request to support@chilkatsoft.com
© 2000-2008 Chilkat Software, Inc. All Rights Reserved.