Sample code for 30+ languages & platforms
Android™

Set Uncommon Email Options

See more Email Object Examples

Demonstrates the Chilkat Email.UncommonOptions property, a catch-all for uncommon needs. It defaults to the empty string and should typically remain empty. Recognized keywords include NoBccHeader (do not add the Bcc MIME header for BCC addresses — which must be set before calling AddBcc or AddMultipleBcc) and NO_FORMAT_FLOWED (do not automatically add format=flowed to a Content-Type header). This example sets NoBccHeader.

Background: Long-lived libraries accumulate rare, situational tweaks that do not each deserve their own property. Chilkat gathers these into a single keyword-driven UncommonOptions string. NoBccHeader is a good example: normally a Bcc header is generated (and stripped at send time), but certain workflows want it omitted entirely. Only documented keywords have any effect — unrecognized text is ignored — so leave this empty unless a specific compatibility need arises.

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 Email.UncommonOptions property, a catch-all for uncommon needs.
    //  It defaults to empty and should usually remain empty.  Recognized keywords include
    //  "NoBccHeader" (do not add the Bcc MIME header) and "NO_FORMAT_FLOWED".

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

    //  Do not add the Bcc MIME header for BCC recipients.  This keyword must be set
    //  before calling AddBcc or AddMultipleBcc.
    email.put_UncommonOptions("NoBccHeader");

    email.AddBcc("Joe","joe@example.com");

    Log.i(TAG, "UncommonOptions = " + email.uncommonOptions());

  }

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