Android™
Android™
Set the Reply-To Address of an Email
See more Email Object Examples
Demonstrates the Chilkat Email.ReplyTo property, which sets the MIME Reply-To header. This header automatically defaults to the From address, so you only set it when replies should go to a different address. There is usually a single Reply-To address, but you can supply a comma-separated list for several. Setting this changes only the Reply-To header — it does not change the SMTP envelope sender or the visible From header.
Background: When you hit "Reply," most mail clients address the response to the message's
Reply-To header if present, otherwise to From. This is useful when the sending address is not the right destination for responses — for example, a newsletter sent from noreply@ but with Reply-To pointing at a monitored support inbox, or a message sent on someone's behalf that should be answered to a different person.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);
// Demonstrates the Email.ReplyTo property, which sets the Reply-To header field.
// Reply-To defaults to the From address, so you only set this when replies should
// go somewhere different.
CkEmail email = new CkEmail();
email.put_From("sales@example.com");
// Replies should be directed to a different address than the From address.
email.put_ReplyTo("support@example.com");
Log.i(TAG, "ReplyTo = " + email.replyTo());
// For multiple reply addresses, use a comma-separated list.
email.put_ReplyTo("support@example.com, help@example.com");
Log.i(TAG, "ReplyTo = " + email.replyTo());
}
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."
}
}