Sample code for 30+ languages & platforms
Objective-C

Clear the Cc Recipients of an Email

See more Email Object Examples

Demonstrates the Chilkat Email.ClearCC method, which clears the list of carbon-copy (Cc) recipients. It changes only the current in-memory email object and does not affect messages already sent. This example adds two Cc recipients, clears them, and prints the count before and after.

Background: When an Email object is reused to send personalized messages, the Cc list from one send would otherwise carry over to the next. ClearCC resets just that list, letting you re-populate it per recipient while keeping the rest of the message intact. It is the counterpart to ClearTo and ClearBcc.

Chilkat Objective-C Downloads

Objective-C
#import <CkoEmail.h>

//  Demonstrates the ClearCC method, which clears the list of carbon-copy (Cc) recipients.
//  This changes only the current email object.

CkoEmail *email = [[CkoEmail alloc] init];

[email AddCC: @"Joe" emailAddress: @"joe@example.com"];
[email AddCC: @"Jane" emailAddress: @"jane@example.com"];
NSLog(@"%@%d",@"NumCC before clear = ",[email.NumCC intValue]);

//  Remove all Cc recipients.
[email ClearCC];

NSLog(@"%@%d",@"NumCC after clear = ",[email.NumCC intValue]);