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
|
(IOS) Save Email Attachments to FilesystemSaves email attachments to a directory. Download: Chilkat IOS (IPhone) Objective-C Libraries NSMutableString *strOutput = [NSMutableString stringWithCapacity:1000]; CkoEmail *email = [[[CkoEmail alloc] init] autorelease]; // Load an email object containing attachments. // This .eml can be downloaded from: // http://www.example-code.com/testData/HtmlEmail.eml BOOL success; success = [email LoadEml: @"HtmlEmail.eml"]; if (success != YES) { [strOutput appendString: email.LastErrorText]; [strOutput appendString: @"\n"]; self.mainTextField.stringValue = strOutput; return; } // If OverwriteExisting is turned on, files with the same // name are overwritten. If turned off, new/unique filenames // are automatically generated. The filenames actually saved // are accessible via the GetAttachmentFilename method. email.OverwriteExisting = YES; // Save all attachments to the "myAttachments" subdirectory // found under the calling process's current working directory. // This directory is automatically created if it does not already // exist. success = [email SaveAllAttachments: @"myAttachments"]; if (success != YES) { [strOutput appendString: email.LastErrorText]; [strOutput appendString: @"\n"]; self.mainTextField.stringValue = strOutput; return; } // List the attachment filenames: int i; for (i = 0; i <= [email.NumAttachments intValue] - 1; i++) { [strOutput appendString: [email GetAttachmentFilename: [NSNumber numberWithInt: i]]]; [strOutput appendString: @"\n"]; } self.mainTextField.stringValue = strOutput; |
© 2000-2013 Chilkat Software, Inc. All Rights Reserved.