Sample code for 30+ languages & platforms
Android™

Request a Return Receipt for an Email

See more Email Object Examples

Demonstrates the Chilkat Email.ReturnReceipt property. Set it to true to request a return-receipt when the message is received; this causes a Disposition-Notification-To header to be added when the email is sent. The default is false. This example enables the request.

Background: A return receipt (technically a Message Disposition Notification, MDN) asks the recipient's mail client to send back a small confirmation when the message is opened. It is only a request: the receiving client or server is free to ignore it, and many prompt the user before sending anything. Because of this, a return receipt is not reliable proof that a human actually read the message — treat it as a courtesy signal, not a guarantee.

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.ReturnReceipt property.  Set to true to request a
    //  return-receipt when the email is received.  This causes a Disposition-Notification-To
    //  header to be added when the email is sent.  The default is false.

    CkEmail email = new CkEmail();
    email.put_Subject("Please confirm receipt");
    email.put_Body("Kindly confirm you received this message.");
    email.put_From("alice@example.com");
    email.AddTo("Bob","bob@example.com");

    //  Request a return receipt.
    email.put_ReturnReceipt(true);

    Log.i(TAG, "ReturnReceipt = " + String.valueOf(email.get_ReturnReceipt()));

  }

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