Package javax.mail.search

Examples of javax.mail.search.FlagTerm


  }
 
  public boolean searchReadEmails(boolean current){
    if(current){
      try {
        messages = folder.search(new FlagTerm(new Flags(Flag.SEEN), false),messages);
      } catch (MessagingException e) {
        System.out.println("The SEEN flag is not supported by "+protocol+" protocol.");
        e.printStackTrace();
        return false;
      }
      return true;
    }
    try {
      messages = folder.search(new FlagTerm(new Flags(Flag.SEEN), true));
    } catch (MessagingException e) {
      System.out.println("The SEEN flag is not supported by "+protocol+" protocol.");
      e.printStackTrace();
      return false;
    }
View Full Code Here


  }
 
  public boolean searchUnRepliedEmails(boolean current){
    if(current){
      try {
        messages = folder.search(new FlagTerm(new Flags(Flag.SEEN), false),messages);
      } catch (MessagingException e) {
        System.out.println("The SEEN flag is not supported by "+protocol+" protocol.");
        e.printStackTrace();
        return false;
      }
      return true;
    }
    try {
      messages = folder.search(new FlagTerm(new Flags(Flag.ANSWERED), false));
    } catch (MessagingException e) {
      System.out.println("The SEEN flag is not supported by "+protocol+" protocol.");
      e.printStackTrace();
      return false;
    }
View Full Code Here

  }
 
  public boolean searchRepliedEmails(boolean current){
    if(current){
      try {
        messages = folder.search(new FlagTerm(new Flags(Flag.SEEN), false),messages);
      } catch (MessagingException e) {
        System.out.println("The SEEN flag is not supported by "+protocol+" protocol.");
        e.printStackTrace();
        return false;
      }
      return true;
    }
    try {
      messages = folder.search(new FlagTerm(new Flags(Flag.ANSWERED), true));
    } catch (MessagingException e) {
      System.out.println("The SEEN flag is not supported by "+protocol+" protocol.");
      e.printStackTrace();
      return false;
    }
View Full Code Here

  }
 
  public boolean searchDeletedEmails(boolean current){
    if(current){
      try {
        messages = folder.search(new FlagTerm(new Flags(Flag.SEEN), false),messages);
      } catch (MessagingException e) {
        System.out.println("The SEEN flag is not supported by "+protocol+" protocol.");
        e.printStackTrace();
        return false;
      }
      return true;
    }
    try {
      messages = folder.search(new FlagTerm(new Flags(Flag.DELETED), true));
    } catch (MessagingException e) {
      System.out.println("The SEEN flag is not supported by "+protocol+" protocol.");
      e.printStackTrace();
      return false;
    }
View Full Code Here

  }
 
  public boolean searchDraftEmails(boolean current){
    if(current){
      try {
        messages = folder.search(new FlagTerm(new Flags(Flag.SEEN), false),messages);
      } catch (MessagingException e) {
        System.out.println("The SEEN flag is not supported by "+protocol+" protocol.");
        e.printStackTrace();
        return false;
      }
      return true;
    }
    try {
      messages = folder.search(new FlagTerm(new Flags(Flag.DRAFT), true));
    } catch (MessagingException e) {
      System.out.println("The SEEN flag is not supported by "+protocol+" protocol.");
      e.printStackTrace();
      return false;
    }
View Full Code Here

  }
 
  public boolean searchFlaggedEmails(boolean current){
    if(current){
      try {
        messages = folder.search(new FlagTerm(new Flags(Flag.SEEN), false),messages);
      } catch (MessagingException e) {
        System.out.println("The SEEN flag is not supported by "+protocol+" protocol.");
        e.printStackTrace();
        return false;
      }
      return true;
    }
    try {
      messages = folder.search(new FlagTerm(new Flags(Flag.FLAGGED), true));
    } catch (MessagingException e) {
      System.out.println("The SEEN flag is not supported by "+protocol+" protocol.");
      e.printStackTrace();
      return false;
    }
View Full Code Here

  }
 
  public boolean searchUnflaggedEmails(boolean current){
    if(current){
      try {
        messages = folder.search(new FlagTerm(new Flags(Flag.SEEN), false),messages);
      } catch (MessagingException e) {
        System.out.println("The SEEN flag is not supported by "+protocol+" protocol.");
        e.printStackTrace();
        return false;
      }
      return true;
    }
    try {
      messages = folder.search(new FlagTerm(new Flags(Flag.FLAGGED), false));
    } catch (MessagingException e) {
      System.out.println("The SEEN flag is not supported by "+protocol+" protocol.");
      e.printStackTrace();
      return false;
    }
View Full Code Here

        return new Mail[0];
      }
      // Attributes & Flags for all messages ..
      final Message[] msgs;
      if (filter.isOnlyRecent() == true) {
        msgs = folder.search(new FlagTerm(new Flags(Flags.Flag.SEEN), false));
      } else {
        msgs = folder.getMessages();
      }
      // Use a suitable FetchProfile
      final FetchProfile fp = new FetchProfile();
View Full Code Here

        logger.info("Connected to mail service using " + cfg.getMailSessionProperties());
        String searchDirectory = cfgProperties.getProperty("search.directory");
        Folder folder = hasText(searchDirectory) ? store.getFolder(searchDirectory) : store.getFolder("inbox");
        folder.open(Folder.READ_WRITE);
        logger.info("Folder " + searchDirectory + " opened successfully");
        Message[] messages = folder.search(new FlagTerm(new Flags(Flags.Flag.SEEN), false));
        logger.info("Found " + messages.length + " messages in " + folder.getFullName());
        List<Message> processed = new ArrayList();
        for (Message msg : messages) {
            try {
                processMessage(msg, cfg, toolBpmSession);
View Full Code Here

     */
    private javax.mail.Message[] retrieveMessages(Folder folder) throws MessagingException {
      javax.mail.Message[] messages = null;

      if (configuration.isUnseen()) {
        FlagTerm ft = new FlagTerm(new Flags(Flags.Flag.SEEN), false);
        messages = folder.search(ft);
      } else {
        messages = folder.getMessages();
      }

View Full Code Here

TOP

Related Classes of javax.mail.search.FlagTerm

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.