Chilkat HOME Android™ ASP Visual Basic VB.NET C# iOS (IPhone) Objective-C C++ C Unicode C++ Unicode C MFC Delphi DLL Delphi ActiveX FoxPro Java Perl PHP Extension PHP ActiveX Python PowerShell Ruby SQL Server VBScript
Unzip Email AttachmentsDownload: 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 |
© 2000-2013 Chilkat Software, Inc. All Rights Reserved.