Sample code for 30+ languages & platforms
CkJava Requires Chilkat v11.0.0+

Set the display priority of a message

See more Email Object Examples

Set X-Priority to 1 (high), 3 (normal), or 5 (low). A mail reader can use it as a display hint. SMTP delivery order is controlled by the mail system.

Chilkat CkJava Downloads

CkJava
import com.chilkatsoft.*;

public class ChilkatExample {

  static {
    try {
        System.loadLibrary("chilkat");
    } catch (UnsatisfiedLinkError e) {
      System.err.println("Native code library failed to load.\n" + e);
      System.exit(1);
    }
  }

  public static void main(String argv[])
  {
    boolean success = false;

    //  Assumes Chilkat is unlocked. See Global Unlock Sample.

    CkEmail email = new CkEmail();
    email.put_From("Workshop team <events@example.com>");
    success = email.AddTo("Alex Rivera","alex@example.net");
    if (success != true) {
        System.out.println(email.lastErrorText());
        return;
        }

    email.put_Subject("Workshop venue change");
    email.put_Body("Please use the north entrance.");
    email.AddHeaderField("X-Priority","1 (High)");
    System.out.println("Priority: " + email.getHeaderField("X-Priority"));

    success = email.SaveEml("venue-change.eml");
    if (success != true) {
        System.out.println(email.lastErrorText());
        return;
        }

    System.out.println("Saved venue-change.eml.");
  }
}