Sample code for 30+ languages & platforms
Objective-C

Get a Cc Recipient's Name Only

See more Email Object Examples

Demonstrates the Chilkat Email.GetCcName method, which returns only the friendly-name part (not the address) of the Nth carbon-copy recipient. The index is zero-based. This example adds two Cc recipients and prints each one's display name.

Background: A recipient combines a display name with an address, such as Jane Doe <jane@example.com>. GetCcName returns just the Jane Doe portion, which is handy for showing a friendly label in a UI. The name is optional free-form text, so it may be empty — when it is, fall back to the address from GetCcAddr.

Chilkat Objective-C Downloads

Objective-C
#import <CkoEmail.h>

//  Demonstrates the GetCcName method, which returns only the friendly-name part (not the
//  address) of the Nth carbon-copy recipient.  The index is zero-based.

CkoEmail *email = [[CkoEmail alloc] init];
email.Subject = @"GetCcName example";

[email AddCC: @"Joe Smith" emailAddress: @"joe@example.com"];
[email AddCC: @"Jane Doe" emailAddress: @"jane@example.com"];

int n = [email.NumCC intValue];
int i;
for (i = 0; i <= n - 1; i++) {
    NSLog(@"%@%d%@%@",@"Cc ",i,@" name: ",[email GetCcName: [NSNumber numberWithInt: i]]);
}