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
Service
PPMD
Deflate
DH Key Exchange
DSA
SSH Key
SSH
SSH Tunnel
SFTP

Unreleased...
Bzip2
LZW
Bz2
Icon

 

 

 

 

 

 

Load File into MIME Body

C# example program showing how to load the complete contents of a file into a MIME body.

/*
    A MIME body can be loaded with the contents of a file.
    The Chilkat MIME component automatically maps the file extension
    to a content-type.  If no mapping is found, the content-type is
    set to application/octet-stream and the content-transfer-encoding
    is set to base64.  Otherwise the content-transfer-encoding
    is set to what is appropriate for the file contents.

    Information about the filename is also automatically saved to
    the content-disposition header field, and a "name" property is
    automatically added to the content-type header field.
    
    Note: content-transfer-encoding and content-type can be updated
    after loading the body from a file by simply setting the ContentType
    and Encoding properties.  The other header fields and attributes
    can also be removed.

*/

Chilkat.Mime mime = new Chilkat.Mime();
mime.UnlockComponent("anything for 30-day trial");

// Load the MIME body with a GIF file.
mime.SetBodyFromFile("dude.gif");

// Let's see what we get:
textBox1.Text = mime.GetMime();

/* Produces this MIME:

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
...

*/

// Remove the "name" attribute from the content-type:
mime.Name = "";
// Remove the "filename" attribute from the content-disposition:
mime.Filename = "";
// Remove the content-disposition altogether:
mime.Disposition = "";



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