Sample code for 30+ languages & platforms
Java

Example: MailMan.FetchAll method

Demonstrates how to call the FetchAll method.

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;

    success = false;
    CkMailMan mailman = new CkMailMan();

    //  Setup mailman with POP3 server and login settings...
    //  ...
    //  ...

    CkEmailBundle bundle = new CkEmailBundle();
    boolean keepOnServer = true;
    boolean headersOnly = false;
    //  numBodyLines only applies if downloading headers-only.
    int numBodyLines = 0;

    success = mailman.FetchAll(keepOnServer,headersOnly,numBodyLines,bundle);
    if (success == false) {
        System.out.println(mailman.lastErrorText());
        return;
        }

    //  ...
    //  ...
  }
}