Chilkat
HOME
Android™
ASP
Visual Basic
VB.NET
C#
iOS (IPhone)
Objective-C
C++
C
MFC
Delphi
FoxPro
Java
Perl
PHP Extension
PHP ActiveX
Python
PowerShell
Ruby
SQL Server
VBScript
Saving Email Attachments IndividuallyDownload: Chilkat .NET Assemblies This example shows how to save email attachments individually. // This example demonstrates how to save email attachments individually. Chilkat.MailMan mailman = new Chilkat.MailMan(); mailman.UnlockComponent("30-day trial"); mailman.MailHost = "mail.chilkatsoft.com"; mailman.PopUsername = "***"; mailman.PopPassword = "***"; Chilkat.EmailBundle bundle = mailman.CopyMail(); int i; int n = bundle.MessageCount; for (i=0; i<n; i++) { Chilkat.Email email = bundle.GetEmail(i); // Set OverwriteExisting = false if you do not want // SaveAttachedFile to overwrite existing files with the same // filename. In that case, the filename is appended with // a few random characters to make it unique. You may then // get the actual filename saved by calling GetAttachmentFilename // after the SaveAttachedFile method call. email.OverwriteExisting = false; int numAttachments = email.NumAttachments; int j; for (j=0; j<numAttachments; j++) { string filenameBefore = email.GetAttachmentFilename(j); email.SaveAttachedFile(j,"c:/myAttachments"); string filenameAfter = email.GetAttachmentFilename(j); } } Important: The download for this
example does not contain the ChilkatDotNet.dll which |
© 2000-2012 Chilkat Software, Inc. All Rights Reserved.