Create an instance of IMailbox by calling createMailbox() from the servlet's controlling AppLogic instance (Accessing the Controlling AppLogic). In this call, you specify valid user information and the name of the POP server you want to access. For example:
IMailbox mb;
mb = al.createMailbox("mail.myOrg.com","myUserName",
"pass7878","sid@blm.org");
Open a session on your POP server by calling open() with the OPEN_RECV flag. For example:
result = mb.open(GX_MBOX_OPEN_FLAG.OPEN_RECV);
To find out whether you have messages, call retrieveCount(). For example:
int mbCount = mb.retrieveCount();
To retrieve messages, instantiate an IValList object to contain the email messages, then call retrieve(). For example, the following code retrieves the latest unread messages and does not delete them from the mailbox:
IValList messages = GX.CreateValList();
messages = mb.retrieve(true, false);
To undo changes, call retrieveReset(). For example:
result = mb.retrieveReset();
To close the session, call close(). For example:
mb.close();