iOS/IPhone Programming Examples

ChilkatHOMEAndroid™Classic ASPCC++C#C# WinRTDelphi ActiveXDelphi DLLVisual FoxProJavaMFCObjective-CPerlPHP ActiveXPHP ExtensionPowerShellPythonRubySQL ServerUnicode CUnicode C++Visual Basic 6.0VB.NETVB.NET WinRTVBScript

iOS/IPhone Examples

Bounced Email
Digital Certificates
Digital Signatures
DKIM / DomainKey
DSA
Email Object
Encryption
FTP
HTML-to-XML
HTTP
IMAP
MHT / HTML Email
POP3
RSA
MIME
SMTP
Socket
SOCKS Proxy
Spider
SSH Key
SSH
SFTP
Tar
Upload
XML
XMP
Zip


More Examples...
Amazon S3
NTLM
RSS
Atom
PPMD
Deflate
Bzip2
LZW
Diffie-Hellman
Bz2
Character Encoding
CSV

 

 

 

 

 

 

 

 

(IOS) Save Email Attachments to Filesystem

Saves email attachments to a directory.

Chilkat iOS Objective-C Libraries

Chilkat iOS C/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.