// check attrs
if(port==-1)port=getDefaultPort();
//PopClient client = new PopClient(server,port,username,password);
MailClient client = MailClient.getInstance(getType(),server,port,username,password);
client.setTimeout(timeout*1000);
client.setMaxrows(maxrows);
if(startrow>1)client.setStartrow(startrow-1);
client.setUniqueFilenames(generateUniqueFilenames);
if(attachmentPath!=null)client.setAttachmentDirectory(attachmentPath);
if(uid!=null)messageNumber=null;
try {
client.connect();
if(action.equals("getheaderonly")) {
required(getTagName(),action,"name",name);
pageContext.setVariable(name,client.getMails(messageNumber,uid,false));
}
else if(action.equals("getall")) {
required(getTagName(),action,"name",name);
pageContext.setVariable(name,client.getMails(messageNumber,uid,true));
}
else if(action.equals("delete")) {
client.deleteMails(messageNumber,uid);
}
else throw new ApplicationException("invalid value for attribute action, valid values are [getHeaderOnly,getAll,delete]");
}
catch(Exception e) {
throw Caster.toPageException(e);
}
finally{
client.disconnectEL();
}
return SKIP_BODY;
}