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
Access Email Attachments in Memory (strings and byte arrays)Download: Chilkat .NET Assemblies C# sample program showing how to access an email's attachments in memory. Chilkat.MailMan mailman = new Chilkat.MailMan(); // Any string argument automatically begins the 30-day trial. 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); int numAttach = email.NumAttachments; int j; for (j=0; j<numAttach; j++) { string contentType = email.GetAttachmentContentType(j); if (contentType.StartsWith("text/")) { // We have a text attachment... // Call GetAttachmentString to get the contents of the text attachment. // The 2nd parameter is the charset of the text, which can be something // like "utf-8", "windows-1252", "shift_JIS", "iso-8859-2", etc. // If you're not sure about what to use, use windows-1252. string attachmentContents = email.GetAttachmentString(j,"windows-1252"); // .... } else { byte [] attachmentData = email.GetAttachmentData(j); // ... } } |
© 2000-2013 Chilkat Software, Inc. All Rights Reserved.