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

Example: MailMan.FetchAll method

Demonstrates how to call the FetchAll method.

Chilkat Java Downloads

Chilkat2 Java
import com.chilkatsoft.chilkat2.ChilkatException;
import com.chilkatsoft.chilkat2.EmailBundle;
import com.chilkatsoft.chilkat2.MailMan;

public class ChilkatExample {

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

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

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

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

        try {
            mailman.fetchAll(keepOnServer, headersOnly, numBodyLines, bundle);
        } catch (ChilkatException e) {
            System.out.println(e.getLastErrorText());
            return;
        }

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