Sample code for 30+ languages & platforms
DataFlex

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

DataFlex
Use ChilkatAx-win32.pkg

Procedure Test
    Handle hoEmail
    Boolean iSuccess
    Integer iTemp1

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

    Get Create (RefClass(cComChilkatEmail)) To hoEmail
    If (Not(IsComObjectCreated(hoEmail))) Begin
        Send CreateComObject of hoEmail
    End

    Get ComAddCC Of hoEmail "Joe" "joe@example.com" To iSuccess
    Get ComAddCC Of hoEmail "Jane" "jane@example.com" To iSuccess
    Get ComNumCC Of hoEmail To iTemp1
    Showln "NumCC before clear = " iTemp1

    //  Remove all Cc recipients.
    Send ComClearCC To hoEmail

    Get ComNumCC Of hoEmail To iTemp1
    Showln "NumCC after clear = " iTemp1


End_Procedure