Sample code for 30+ languages & platforms
Android™

Count the Cc Recipients of an Email

See more Email Object Examples

Demonstrates the read-only Chilkat Email.NumCC property, which is the number of carbon-copy (Cc) recipients. Cc recipient indexes are zero-based and can be inspected with GetCC, GetCcAddr, and GetCcName. This example adds two Cc recipients and prints the count.

Background: The term "carbon copy" predates email — it comes from the carbon paper once used to make duplicate copies of typed letters. In email, Cc recipients receive a visible copy of the message and, by convention, are people who should be kept informed but are not the primary audience (that role belongs to the To recipients). All To and Cc addresses are visible to every recipient.

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 read-only Email.NumCC property, which is the number of
    //  carbon-copy (Cc) recipients.  Cc indexes are zero-based.

    CkEmail email = new CkEmail();

    email.AddCC("Joe","joe@example.com");
    email.AddCC("Jane","jane@example.com");

    Log.i(TAG, "NumCC = " + 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."
  }
}