C# Examples

ChilkatHOMEAndroid™ASPVisual BasicVB.NETC#iOS (IPhone)Objective-CC++CUnicode C++Unicode CMFCDelphi DLLDelphi ActiveXFoxProJavaPerlPHP ExtensionPHP ActiveXPythonPowerShellRubySQL ServerVBScript

C# Examples

Bounced Mail
Bz2
Character Encoding
CSV
DKIM / DomainKey
Digital Certificates
Digital Signatures
Email
Email Object
FTP
HTML Conversion
HTTP
IMAP
Encryption
MHT / HTML Email
MIME
POP3
RSA
S/MIME
SMTP
Socket
Spider
SSH
SSH Tunnel
SSH Key
SFTP
Tar Archive
Upload
XML
XMP
Zip Compression


More Examples...
Amazon S3
NTLM
FileAccess
RSS
Atom
String
Byte Array
Self-Extractor
Service
PPMD
Deflate
DH Key Exchange
DSA
Bzip2
LZW

 

 

 

 

 

 

multipart/related Email Sub-Parts

Download: Chilkat .NET Assemblies

C# example demonstrating how to access the related items potentially contained within HTML email.

// Related items are the embedded graphics, style sheets, etc. that are
// often included in HTML email.  These are not considered to be "attachments".
// HTML emails that include related items (i.e. embedded images or sytle sheets)
// are formatted as a multipart/related MIME message.  Chilkat makes
// it easy to access the related items, filenames, data, etc. or to save
// the related items to disk files.
// This example demonstrates most of the functionality...
private void SaveRelatedItems(Chilkat.Email email)
{
    string filename;
    byte [] relatedData;
    string relatedString;
    
    // Get the number of related items contained within the email.
    int n = email.NumRelatedItems;
    int i;
    for (i=0; i<n; i++)
    {
        filename = email.GetRelatedFilename(i);
        MessageBox.Show("Related item " + Convert.ToString(i) + " filename = " + filename);
        
        // Save the related item to the "relatedItemsDir" sub-directory
        email.SaveRelatedItem(i, "relatedItemsDir");
       
        // You can access the contents of the related item by calling
        // GetRelatedData.  If (for example) the related item was a GIF file,
        // the relatedData byte array would contain the binary GIF image data.
        relatedData = email.GetRelatedData(i);
        
        // You can also access the contents of a related item as a string.
        // (This would make sense for sytle sheets)
        // The charset passed in the 2nd argument indicates the character encoding
        // of the characters within the text.  Because C# strings are Unicode,
        // the component is (implicitly) converting from that charset to Unicode.
        relatedString = email.GetRelatedString(i, "utf-8");
    }
    
}

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/vbdotnet/step2.asp

 

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