Package com.cubusmail.server.mail

Examples of com.cubusmail.server.mail.IMailbox


   * com.cubusmail.gwtui.client.services.IMailboxService#deleteMessages(long
   * [])
   */
  public void deleteMessages( long[] messageIds ) throws Exception {

    IMailbox mailbox = SessionManager.get().getMailbox();

    if ( messageIds != null && messageIds.length > 0 ) {
      log.debug( "delete " + messageIds.length + " messages..." );

      try {
        if ( mailbox.getCurrentFolder().isTrash() || mailbox.getTrashFolder() == null ) {
          mailbox.deleteMessages( messageIds );
        }
        else {
          copyMoveMessages( messageIds, mailbox.getTrashFolder().getId(), true );
        }
      }
      catch (MessagingException e) {
        log.error( e.getMessage(), e );
        throw new GWTMessageException( e.getMessage() );
View Full Code Here


    try {
      log.debug( "sending message..." );
      MessageHandler messageHandler = SessionManager.get().getCurrentComposeMessage();
      messageHandler.setGWTMessage( message );
      messageHandler.send();
      IMailbox mailbox = SessionManager.get().getMailbox();
      IMailFolder sentFolder = mailbox.getSentFolder();
      messageHandler.saveToFolder( sentFolder, false );
      log.debug( "...successful" );

      try {
        this.userAccountDao.saveRecipients( SessionManager.get().getUserAccount(), messageHandler
View Full Code Here

   * com.cubusmail.gwtui.client.services.IMailboxService#prepareReplyMessage
   * (long)
   */
  public GWTMessage prepareReplyMessage( long messageId, boolean replyAll ) throws Exception {

    IMailbox mailbox = SessionManager.get().getMailbox();
    log.debug( "preparing reply message..." );

    try {
      IMailFolder currentFolder = mailbox.getCurrentFolder();
      Message msg = currentFolder.getMessageById( messageId );

      MessageHandler replyMessageHandler = getMessageHandler( mailbox.getJavaMailSession() );
      replyMessageHandler.createReplyMessage( msg, replyAll );

      SessionManager.get().setCurrentComposeMessage( replyMessageHandler );

      return replyMessageHandler.getGWTMessage();
View Full Code Here

   * com.cubusmail.gwtui.client.services.IMailboxService#openDraftMessage(
   * long)
   */
  public GWTMessage openDraftMessage( long messageId ) throws Exception {

    IMailbox mailbox = SessionManager.get().getMailbox();
    log.debug( "open message for " + messageId + " ..." );

    try {
      IMailFolder selectedFolder = mailbox.getCurrentFolder();
      Message msg = selectedFolder.getMessageById( messageId );

      MessageHandler readHandler = getMessageHandler( mailbox.getJavaMailSession(), (MimeMessage) msg );
      readHandler.readBodyContent( true, MessageTextMode.DRAFT );
      prepareNewMessage();

      GWTMessage result = readHandler.getGWTMessage();

View Full Code Here

   * com.cubusmail.gwtui.client.services.IMailboxService#prepareForwardMessage
   * (long)
   */
  public GWTMessage prepareForwardMessage( long messageId ) throws Exception {

    IMailbox mailbox = SessionManager.get().getMailbox();
    log.debug( "preparing forward message..." );

    try {
      IMailFolder currentFolder = mailbox.getCurrentFolder();
      Message msg = currentFolder.getMessageById( messageId );

      MessageHandler forwardMessageHandler = getMessageHandler( mailbox.getJavaMailSession() );
      forwardMessageHandler.createForwardMessage( msg );

      SessionManager.get().setCurrentComposeMessage( forwardMessageHandler );

      GWTMessage result = forwardMessageHandler.getGWTMessage();
View Full Code Here

  public void saveMessageAsDraft( GWTMessage message ) throws Exception {

    try {
      log.debug( "saving message to draft..." );
      MessageHandler messageHandler = SessionManager.get().getCurrentComposeMessage();
      IMailbox mailbox = SessionManager.get().getMailbox();
      IMailFolder draftFolder = mailbox.getDraftFolder();
      messageHandler.setGWTMessage( message );
      messageHandler.saveToFolder( draftFolder, true );

      // if there is the original message to delete
      if ( message.getId() > 0 ) {
View Full Code Here

   */
  public GWTMailFolder[] retrieveFolderTree() throws Exception {

    long millis = System.currentTimeMillis();

    IMailbox mailbox = SessionManager.get().getMailbox();
    try {
      mailbox.reloadFolder();
    }
    catch (MessagingException e) {
      log.error( e.getMessage(), e );
      throw new GWTMessageException( e.getMessage() );
    }
    GWTMailFolder[] result = ConvertUtil.convert( mailbox.getMailFolderList() );

    log.debug( "Time for retrieveFolderTree(): " + (System.currentTimeMillis() - millis) + "ms" );

    return result;
  }
View Full Code Here

   * com.cubusmail.gwtui.client.services.IMailboxService#createFolder(java
   * .lang.String, java.lang.String)
   */
  public GWTMailFolder createFolder( String parentFolderId, String folderName ) throws Exception {

    IMailbox mailbox = SessionManager.get().getMailbox();
    log.debug( "creating folder... " + folderName );

    IMailFolder newFolder;
    try {
      newFolder = mailbox.createFolder( parentFolderId, folderName );
      log.debug( "...successful" );

      return ConvertUtil.convert( newFolder, true );
    }
    catch (MailFolderException e) {
View Full Code Here

   * com.cubusmail.gwtui.client.services.IMailboxService#moveFolder(java.lang
   * .String, java.lang.String)
   */
  public GWTMailFolder moveFolder( String sourceFolderId, String targetFolderId ) throws Exception {

    IMailbox mailbox = SessionManager.get().getMailbox();
    log.debug( "moving folder... " + sourceFolderId );

    IMailFolder sourceFolder = mailbox.getMailFolderById( sourceFolderId );
    try {
      IMailFolder folder = mailbox.moveFolder( sourceFolderId, targetFolderId );
      log.debug( "...successful" );

      return ConvertUtil.convert( folder, true );
    }
    catch (MailFolderException e) {
View Full Code Here

   * com.cubusmail.gwtui.client.services.IMailboxService#renameFoler(java.
   * lang.String, java.lang.String)
   */
  public GWTMailFolder renameFolder( String folderId, String newName ) throws Exception {

    IMailbox mailbox = SessionManager.get().getMailbox();
    log.debug( "renaming folder... " + folderId );

    try {
      IMailFolder folder = mailbox.renameFolder( folderId, newName );
      log.debug( "...successful" );

      return ConvertUtil.convert( folder, true );
    }
    catch (MailFolderException e) {
View Full Code Here

TOP

Related Classes of com.cubusmail.server.mail.IMailbox

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.