Sample code for 30+ languages & platforms
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 C++ Downloads

C++
#include <CkEmail.h>

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

    CkEmail email;

    email.AddCC("Joe","joe@example.com");
    email.AddCC("Jane","jane@example.com");
    std::cout << "NumCC before clear = " << email.get_NumCC() << "\r\n";

    //  Remove all Cc recipients.
    email.ClearCC();

    std::cout << "NumCC after clear = " << email.get_NumCC() << "\r\n";
    }