Android™
Android™
Create an Inline-Forward Email
See more Email Object Examples
Demonstrates the Chilkat Email.ToForward method, which creates an inline-forward email based on this email. The forward is returned in the argument, and the source email is not modified. The returned email can be edited — adding recipients, prepending a note — before sending. This example forwards a message and adds a recipient.
Background: An inline forward quotes the original message's content within the body of the new message — the familiar "---------- Forwarded message ----------" style — as opposed to attaching the original as a
message/rfc822 part (which AttachEmail does). Chilkat assembles the quoted body and headers for you, leaving the new message ready to address and send.Chilkat Android™ Downloads
// 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);
boolean success = false;
// Demonstrates the ToForward method, which creates an inline-forward email based on this
// email. The forward is returned in the argument; the source email is not modified.
CkEmail email = new CkEmail();
email.put_Subject("Quarterly results");
email.put_From("alice@example.com");
email.AddTo("Bob","bob@example.com");
email.put_Body("Here are the quarterly results.");
// Create an inline-forward email from this message.
CkEmail fwd = new CkEmail();
success = email.ToForward(fwd);
if (success == false) {
Log.i(TAG, email.lastErrorText());
return true;
}
// The forward can be edited to add recipients before sending.
fwd.AddTo("Carol","carol@example.com");
Log.i(TAG, fwd.getMime());
}
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."
}
}