String locURI = record.getKey();
String mail = record.getUid();
try {
// Get mail message store for the default inistance
Store store = Session.getDefaultInstance().getStore();
if (locURI.startsWith("I/")) {
Folder[] folders = store.list(Folder.INBOX);
printFolderInfo(folders);
folder = folders[0];
type = 'I';
}
else if (locURI.startsWith("O/")) {
Folder[] folders = store.list(Folder.OUTBOX);
printFolderInfo(folders);
folder = folders[0];
type = 'O';
}
else if (locURI.startsWith("D/")) {
Folder[] folders = store.list(Folder.DRAFT);
printFolderInfo(folders);
folder = folders[0];
type ='D';
}
else if (locURI.startsWith("S/")) {
Folder[] folders = store.list(Folder.SENT);
printFolderInfo(folders);
folder = folders[0];
type = 'S';
}
else if (locURI.startsWith("T/")) {