Package com.cubusmail.server.mail

Examples of com.cubusmail.server.mail.MessageHandler


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

      MessageHandler handler = getMessageHandler( mailbox.getJavaMailSession(), (MimeMessage) msg );
      handler.readBodyContent( loadImages, MessageTextMode.DISPLAY );
      GWTMessage result = handler.getGWTMessage();

      return result;
    }
    catch (MessagingException e) {
      log.error( e.getMessage(), e );
View Full Code Here


   */
  public void sendMessage( GWTMessage message ) throws Exception {

    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
            .getAllRecipients() );
      }
      catch (Throwable e) {
        // catch all exceptions
        log.error( e.getMessage(), e );
View Full Code Here

   * com.cubusmail.gwtui.client.services.IMailboxService#prepareNewMessage()
   */
  public void prepareNewMessage() {

    log.debug( "preparing new compose message..." );
    MessageHandler newMessageHandler = getMessageHandler( SessionManager.get().getMailbox().getJavaMailSession() );
    SessionManager.get().setCurrentComposeMessage( newMessageHandler );
  }
View Full Code Here

    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();
    }
    catch (MessagingException e) {
      log.error( e.getMessage(), e );
      throw new GWTMessageException( e.getMessage() );
    }
View Full Code Here

    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();

      return result;
    }
    catch (MessagingException e) {
      log.error( e.getMessage(), e );
View Full Code Here

    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();
      result.setAttachments( forwardMessageHandler.getGWTComposeAttachments() );

      return result;
    }
    catch (MessagingException e) {
      log.error( e.getMessage(), e );
View Full Code Here

   * retrieveCurrentComposeMessage()
   */
  public GWTAttachment[] retrieveCurrentComposeMessageAttachments() throws Exception {

    log.debug( "retrieving compose message..." );
    MessageHandler composeMessage = SessionManager.get().getCurrentComposeMessage();
    return composeMessage.getGWTComposeAttachments();
  }
View Full Code Here

   * removeAttachmentFromComposeMessage(int)
   */
  public GWTAttachment[] removeAttachmentFromComposeMessage( int index ) throws Exception {

    log.debug( "removing attachment from compose message..." );
    MessageHandler composeMessage = SessionManager.get().getCurrentComposeMessage();
    if ( composeMessage.getComposeAttachments() != null && composeMessage.getComposeAttachments().size() > 0 ) {
      composeMessage.getComposeAttachments().remove( index );
    }

    return composeMessage.getGWTComposeAttachments();
  }
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 ) {
        long[] deleteId = new long[] { message.getId() };
        deleteMessages( deleteId );
View Full Code Here

   * @param mailSession
   * @return
   */
  private MessageHandler getMessageHandler( Session mailSession ) {

    MessageHandler handler = getApplicationContext().getBean( MessageHandler.class );
    handler.init( mailSession );
    return handler;
  }
View Full Code Here

TOP

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

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.