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

 

 

 

 

 

 

Unzip Email Attachments

Download: Chilkat .NET Assemblies

Demonstrates how .zip attachments can be unzipped directly within the email object.

        // The Chilkat email component can unzip attachments directly in-memory,
        // allowing you to access the data in files contained within .zip attachments directly
        // from your program.
        private void button14_Click(object sender, EventArgs e)
        {
            Chilkat.MailMan mailman = new Chilkat.MailMan();
            mailman.UnlockComponent("Anything for 30-day trial.");

            mailman.MailHost = "mail.chilkatsoft.com";
            mailman.PopUsername = "****";
            mailman.PopPassword = "****";

            // Copy email from the POP3 server, leaving it on the mail server.
            Chilkat.EmailBundle bundle = mailman.CopyMail();
            int i;
            int n = bundle.MessageCount;
            for (i = 0; i < n; i++)
            {
                Chilkat.Email email = bundle.GetEmail(i);

                // Any .zip attachments found within the email will be unzipped
                // and each .zip attachment will be replaced with the files contained 
                // within it.
                // For example, if an email contains a single .zip attachment (x.zip),
                // and x.zip contains (a.txt, b.txt, and c.txt), then after calling
                // UnzipAttachments, the email will contain 3 attachments: a.txt, b.txt, and c.txt.
                // The component does not recursively unzip attachments.  If a .zip contained yet
                // another .zip, you may unzip the nested zip by calling UnzipAttachments twice.
                email.UnzipAttachments();

                // Sample code to display the attachment filenames.
                int j;
                int numAttach = email.NumAttachments;
                for (j = 0; j < numAttach; j++)
                {
                    listBox1.Items.Add(email.GetAttachmentFilename(j));
                }
            }

        }

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.