Sample code for 30+ languages & platforms
Android™

Add a Cc Recipient to an Email

See more Email Object Examples

Demonstrates the Chilkat Email.AddCC method, which adds a single carbon-copy (Cc) recipient. The first argument is the friendly display name and the second is the email address. This example adds one Cc recipient and prints the resulting count.

Background: Cc ("carbon copy") recipients receive a visible copy of the message and, unlike Bcc, their addresses appear in the delivered headers for all recipients to see. By convention, To is for the people expected to act on the message and Cc is for those who should be kept in the loop. Functionally the mail server delivers to To and Cc addresses identically — the distinction is one of etiquette and intent.

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 AddCC method, which adds a single carbon-copy (Cc) recipient.
    //  The 1st argument is the friendly (display) name, and the 2nd is the email address.

    CkEmail email = new CkEmail();
    email.put_Subject("Cc example");
    email.put_From("alice@example.com");

    email.AddCC("Joe","joe@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."
  }
}