Sample code for 30+ languages & platforms
Java

Transition from MailMan.FetchMultipleHeaders to MailMan.FetchUidlSet

Provides instructions for replacing deprecated FetchMultipleHeaders method calls with FetchUidlSet.

Chilkat Java Downloads

Java
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;

    CkMailMan mailman = new CkMailMan();

    //  ...
    //  ...

    CkStringArray saUidls = new CkStringArray();
    saUidls.Append("aaa");
    saUidls.Append("bbb");
    saUidls.Append("ccc");

    CkStringTable stUidls = new CkStringTable();
    stUidls.Append("aaa");
    stUidls.Append("bbb");
    stUidls.Append("ccc");

    int numBodyLines = 5;

    //  ------------------------------------------------------------------------
    //  The FetchMultipleHeaders method is deprecated:

    CkEmailBundle bundleObj = mailman.FetchMultipleHeaders(saUidls,numBodyLines);
    if (mailman.get_LastMethodSuccess() == false) {
        System.out.println(mailman.lastErrorText());
        return;
        }

    //  ...
    //  ...

    //  ------------------------------------------------------------------------
    //  Do the equivalent using FetchUidlSet.
    //  Your application creates a new, empty EmailBundle object which is passed 
    //  in the last argument and filled upon success.

    boolean headersOnly = true;

    CkEmailBundle bundleOut = new CkEmailBundle();
    success = mailman.FetchUidlSet(stUidls,headersOnly,numBodyLines,bundleOut);
    if (success == false) {
        System.out.println(mailman.lastErrorText());
        return;
        }
  }
}