Sample code for 30+ languages & platforms
Android™

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 Android™ Downloads

Android™
// Important: Don't forget to include the call to System.loadLibrary
// as shown at the bottom of this code sample.
package com.test;

import android.app.Activity;
import com.chilkatsoft.*;

import android.widget.TextView;
import android.os.Bundle;

public class SimpleActivity extends Activity {

  private static final String TAG = "Chilkat";

  // Called when the activity is first created.
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

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

    CkEmail email = new CkEmail();

    email.AddCC("Joe","joe@example.com");
    email.AddCC("Jane","jane@example.com");
    Log.i(TAG, "NumCC before clear = " + String.valueOf(email.get_NumCC()));

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

    Log.i(TAG, "NumCC after clear = " + String.valueOf(email.get_NumCC()));

  }

  static {
      System.loadLibrary("chilkat");

      // Note: If the incorrect library name is passed to System.loadLibrary,
      // then you will see the following error message at application startup:
      //"The application <your-application-name> has stopped unexpectedly. Please try again."
  }
}