Sample code for 30+ languages & platforms
Android™

Add Multiple Bcc Recipients at Once

See more Email Object Examples

Demonstrates the Chilkat Email.AddMultipleBcc method, which parses a comma-separated list of mailbox addresses and appends them all to the blind carbon-copy (Bcc) recipient list. Each entry may include a display name (e.g. Joe <joe@example.com>). This example adds three Bcc recipients in one call.

Background: Address lists in email are comma-separated, and each entry can be either a bare address (jane@example.com) or a named form (Jane Doe <jane@example.com>). AddMultipleBcc parses that syntax for you, which is convenient when recipients come from a database column or a config file as a single string — rather than calling AddBcc once per person, you hand over the whole list at once.

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 AddMultipleBcc method, which parses a comma-separated list of
    //  addresses and appends them all to the blind carbon-copy (Bcc) recipient list.

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

    //  Add several Bcc recipients at once.  Each entry may include a display name.
    email.AddMultipleBcc("Joe <joe@example.com>, jane@example.com, Bob <bob@example.com>");

    Log.i(TAG, "NumBcc = " + String.valueOf(email.get_NumBcc()));

  }

  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."
  }
}