1 25 26 package net.killingar.actions.email; 27 28 import javax.mail.Folder ; 29 import javax.mail.MessagingException ; 30 31 public class View extends MailSupport 32 { 33 35 36 String folder; 38 Mail mail; 39 int messageNumber; 40 41 public String getFolder() { return folder; } 43 public Mail getMail() { return mail; } 44 45 public void setFolder(String in) { folder = in; } 47 public void setMessageNumber(int in) { messageNumber = in; } 48 49 public String doExecute() 51 { 52 try 53 { 54 Folder folder = mailStore.getDefaultFolder(); 56 folder = folder.getFolder(this.folder); 57 try 58 { 59 folder.open(Folder.READ_WRITE); 60 } 61 catch (MessagingException ex) 62 { 63 folder.open(Folder.READ_ONLY); 64 } 65 66 javax.mail.Message msg = folder.getMessage(messageNumber); 67 68 mail = new Mail(msg); 69 70 76 77 folder.close(false); 78 } 79 catch (Exception e) 80 { 81 addErrorMessage("viewing mailbox failed, exception thrown ("+e.toString()+")"); 82 e.printStackTrace(); 83 84 return ERROR; 85 } 86 87 return SUCCESS; 88 } 89 } 90 | Popular Tags |