Sample code for 30+ languages & platforms
PureBasic

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 PureBasic Downloads

PureBasic
IncludeFile "CkEmail.pb"

Procedure ChilkatExample()

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

    email.i = CkEmail::ckCreate()
    If email.i = 0
        Debug "Failed to create object."
        ProcedureReturn
    EndIf

    CkEmail::ckAddCC(email,"Joe","joe@example.com")
    CkEmail::ckAddCC(email,"Jane","jane@example.com")
    Debug "NumCC before clear = " + Str(CkEmail::ckNumCC(email))

    ;  Remove all Cc recipients.
    CkEmail::ckClearCC(email)

    Debug "NumCC after clear = " + Str(CkEmail::ckNumCC(email))


    CkEmail::ckDispose(email)


    ProcedureReturn
EndProcedure