Folder folderRoot;
boolean isAuthenticated;
public EmailConnection(RewriteContext hr) {
String connHandle = getConnHandle(hr);
PasswordAuthentication pa;
final String IMAP_PORT = "143";
String tmpServer;
String server;
String port;
/* Setup our internal values */
user = hr.get("user");
tmpServer = hr.get("server");
if (tmpServer.indexOf(":") != -1) {
server = tmpServer.substring(0,tmpServer.indexOf(":"));
port = tmpServer.substring(tmpServer.indexOf(":")+1);
} else {
server = tmpServer;
port = IMAP_PORT;
}
openFolders = new Hashtable();
hr.request.log(Server.LOG_DIAGNOSTIC,connHandle,"user = " + user);
hr.request.log(Server.LOG_DIAGNOSTIC,connHandle,"server = " + server);
hr.request.log(Server.LOG_DIAGNOSTIC,connHandle,"port = " + port);
/* Create our URLName for the server connection */
serverURL = new URLName("imap://" + user + "@" + server + ":" + port);
hr.request.log(Server.LOG_DIAGNOSTIC,connHandle,"serverURL = " + serverURL.toString());
pa = new PasswordAuthentication(user,hr.get("password"));
/* Register our authentication object with the mail session */
defMailSession.setPasswordAuthentication(serverURL,pa);
}