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
|
Iterate Email HeadersDemonstrates how to iterate over the email header fields. Download: Chilkat Cocoa Objective-C Libraries NSMutableString *strOutput = [NSMutableString stringWithCapacity:1000]; CkoEmail *email = [[[CkoEmail alloc] init] autorelease]; // First, load an email from a file. // Note: an email object may be loaded from a file, or // downloaded directly from a POP3 or IMAP server... BOOL success; success = [email LoadEml: @"testReceivedHdrs.eml"]; if (success != YES) { [strOutput appendString: email.LastErrorText]; [strOutput appendString: @"\n"]; self.mainTextField.stringValue = strOutput; return; } // How many header fields? int n; n = [email.NumHeaderFields intValue]; if (n > 0) { // Display the name and value of each header: int i; NSString *name; NSString *value; for (i = 0; i <= n - 1; i++) { name = [email GetHeaderFieldName: [NSNumber numberWithInt: i]]; value = [email GetHeaderFieldValue: [NSNumber numberWithInt: i]]; [strOutput appendString:[NSString stringWithFormat: @"%d\n",i]]; [strOutput appendString: name]; [strOutput appendString: @"\n"]; [strOutput appendString: value]; [strOutput appendString: @"\n"]; } } self.mainTextField.stringValue = strOutput; |
© 2000-2013 Chilkat Software, Inc. All Rights Reserved.